Hi folks
my question is how to setup some attributes when build new assosiated
record depends of assosiation?
i have 2 simple models
class Person < ActiveRecord::Base
belongs_to :school
def to_label
"#{full_name}"
end
end
class School < ActiveRecord::Base
has_many :teachers, :class_name => "Person", :conditions =>
{:person_type => 1}
has_many :students, :class_name => "Person", :conditions =>
{:person_type => 2}
end
when i add new teacher record from school controller
school.teacher.new
i need set teacher.person_type = 1
if i add student (school.student.new) i need person_type = 2
i'm using activescaffold for adding records...
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.