Sunday, January 15, 2012

Re: [Rails] I really don't know hot to set an extra attribute of a join model.

I didn't knew :inverse_of, now I read something about it.
But I can I set now the controller actions new and create?
This code creates two managers and not only one:

def new
@company = Company.find(params[:company_id])
@manager = Manager.new
@manager.managements.build
new!
end

def create
@company = Company.find(params[:company_id])
@manager = @company.managers.build(params[:manager])
@manager.company_ids = @company.id
create!
end

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate