You application crashed because you probably have a user of type
"student" but you don't have a matching class for it. As others
explained the migrations and model generations don't use single table
inheritance, so they won't crash on it. Furthermore the generators don't
know which types you want to use in your application, you have to create
these manually as new models
If you look at the ActiveRecord::Base API documentation
(http://api.rubyonrails.org/classes/ActiveRecord/Base.html) and scroll
down to the section on "Single Table Inheritance" you'll see what single
table inheritance is about.
If you want to know more about Rails' API then you can find all of the
API documentation for Rails here: http://api.rubyonrails.org/
You can also get some valuable information from the Rails Guides too:
http://guides.rubyonrails.org/
On 22-2-2011 7:15, Bhasker Harihara wrote:
Hi,
I used "type" as a column in "rails generate model" there was no error.
I did a rake db:migrate again no problem.
I created the values using console again no problem.
I did a show function in users contoller then rails threw up the
error. But should it not give this error right at the time of generate
model or db:migrate or atleast create.
ActiveRecord::SubclassNotFound in UsersController#show
The single-table inheritance mechanism failed to locate the subclass:
'student'. This error is raised because the column 'type' is reserved for
storing the class in case of inheritance. Please rename this column if you
didn't intend it to be used for storing the inheritance class or overwrite
User.inheritance_column to use another column for that information.
--
You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.