[Rails] Re: RUBY ON RAILS GET IDS TO MY DATABASE
Thanks for you replying Colin:
Look, this's my message of error:
NoMethodError in MallacurricularesController#create
undefined method `save' for []:ActiveRecord::Relation
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"CEX4yZeFmrSOspseMm2/d8rzPzu/3FYI2w8d7XZ1Ji0=",
"malla"=>{"clase_id"=>"1",
"subjects_ids"=>["3",
"4",
"5"]},
"level"=>"3",
"commit"=>"GUARDAR"}
The parameters looks good, and my controller is:
def new
@asignatura = Asignatura.find(:all)
@clase = Clase.find(:all)
@nivel = Nivel.find(:all)
@malla = Malla.new
end
def create
@malla = Malla.new(params[:malla])
@subject = @malla.subjects(params[:subject_ids])
@level = @malla.levels(params[:level])
if @malla.save and @subject.save and @level.save
redirect_to mallacurriculares_menu_principal_admin_path, :notice
=> 'MALLA created'
end
end
In my controller i want to save the "ids" that i chose in the view form
to my model: subject_malla_level.
And i dont know how to do it, please help men :(
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home