I am using Ruby on Rails 3.1.0 and I would like to know if it is possible to name a database table column with the word type
without incurring into problems (I know that the "type" word is used in Polymorphic Associations...). Is it?
And if I would like to use, for example, a database table name as article_type
, what kind of problems can I have (without using a Polymorphic Association)?
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 called article_type
wouldn't matter to Rails. It's only the type
column that it is protective of.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With