I have a simple model:
class Post < ActiveRecord::Base
end
It has a column INT
named type
When I create a record:
Post.create(:type => 1)
I get:
NoMethodError: undefined method `safe_constantize' for 1:Fixnum
What am I doing wrong?
Like it is: There are no method called safe_constantize
on a Fixnum.
type
is for Single Table Inheritance. You would usually put a string representation of a known model in your application as a type
value. See rails guides
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