Can a column of a database table be called the word β€œtype” without problems?

I am using Ruby on Rails 3.1.0, and I would like to know if a column of a database table can be named with the word type without any problems (I know that the type word is used in Polymorphic associations ...). It?

And if I would like to use, for example, the name of the database table as article_type , what problems can I (without using the Polymorphic Association)?

+4
source share
1 answer

Yes it is.

You can use the type column if you define this in your model:

 class Model < ActiveRecord::Base self.inheritance_column = nil end 

Having a table named article_type doesn't matter for Rails. This is only the type column that it protects.

+10
source

Source: https://habr.com/ru/post/1389207/


All Articles