I have implemented single table inheritance for a person class
class Person < ActiveRecord::Base
end
class Teacher < Person
end
class Student < Person
end
class Outsider < Person
end
And the create person seems to work creating Teacher, Student or Person according to the what is chosen in the form.select and the type attribute is added.
However, I seem to have broken the routes
<%= link_to ‘Edit’, edit_person_path(@deal) %> |
<%= link_to ‘Back’, persons_path %>
They seem to point to teacher_path, student_path and outsider_path instead of person_path.
What changes need to be made in the routes?
first generate controllers for your models…
then in routes.rb (rails 3)
gives you REST routes
e.g.
the same for teacher, student and outsider
check rake routes
or rake routes | grep teachers