I have a simple model called PhoneNumber:
class PhoneNumber < ActiveRecord::Base
validates :pnumber, presence: true, on: :create #=> { :message =>
In my case, I named a column name type and tried to set its value as UNPREPARED. And I got an error message like this:
Caused by: api_1 | NameError: uninitialized constant UNPREPARED
In rails, column type is reserved:
ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'UNPREPARED'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Pl ease rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Food.inheritance_column to use another column for that information