Hi Pamela,

You are using 2 objects with same name @norma_legal. First correct that

David

On Wed, May 4, 2011 at 7:58 PM, pamela martinez <
[email protected]> wrote:

> Hi, my name is pamela and i don't know if this group is active, but i send
> this mail anyway :D
>
> I'm having problems with some parameters that are in another table, i mean,
> in my *new* view i put this:
>
> <p>
>     <%= f.label 'Norma Legal' %><br />
>     <%= select("norma_legal", "id", @norma_legal.collect {|c|
> ["#{c.desc_normalegal}/ #{c.nro_norma_legal}/ #{c.anio_norma_legal}", c.id]})
> %>
> </p>
>
> This shows me a the data contained in the table the way i want, but in the
> moment of create y get this error: undefined method `norma_legal' for
> #<Obra:0xe229be>
>
> *Parameters*:
>
> {"authenticity_token"=>"EVLBHoUoAaf8/l/oz9ftWHujKIIYfbel5mm5IzkVERI=",
>  "obra"=>{"id_ejecutor"=>"1",
>  "id_financ"=>"3",
>  "id_dpto"=>"57",
>  "nro_expte"=>"",
>  "nombre_obra"=>"",
>  "nro_certif_obra"=>"",
>  "porc_ejec_obra"=>""},
>  *"norma_legal"=>{"id"=>"1"},*
>  "commit"=>"Create"}
>
>
> I think that the *id* seems to get lost somehwere, and i don't know why, i
> have this in my controller
>
> def create
>     @obra = Obra.new(params[:obra])
>     @norma_legal = NormaLegal.all
>
>     @norma_legal = NormaLegal.find(params[:norma_legal][:id])
>     @obra.norma_legal << @norma_legal
>
>     respond_to do |format|
>       if @obra.save
>         format.html { redirect_to(@obra, :notice => 'Obra was successfully
> created.') }
>         format.xml  { render :xml => @obra, :status => :created, :location
> => @obra }
>       else
>         format.html { render :action => "new" }
>         format.xml  { render :xml => @obra.errors, :status =>
> :unprocessable_entity }
>       end
>     end
>   end
>
>
> Thank you very much
> Pamela
>
> --
> You received this message because you are subscribed to the Google
> Groups "ruby-on-rails-programming-with-passion" group.
> To unsubscribe from this group, send email to
> ruby-on-rails-programming-with-passion+unsubscr...@googlegroups.com
> For more options, visit this group at
>
> http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en




-- 
Regards

David Raj Samuel

"What good its for a man to gain the Whole World, yet forfeit his SOUL" -
Jesus Christ

-- 
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
ruby-on-rails-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en

Reply via email to