Re: [Rails] Re: Fail to pass id to foreign table
On 17 April 2013 12:37, Ryo Saeba <lists@ruby-forum.com> wrote:
> Allright I fixed this problem to. my helper path simply needed the game
> parameter
>
> new_game_review_path(@game)
>
>
> The form for creating a new review looks now like this
>
> <%= form_for(@review, :url => game_reviews_path(@game)) do |f| %>
>
>
> But unfortunately I end up with the same problem. the game object is
> still nil and I can't get the game_id :/
>
> having this hidden_field_tag in my form causes me the "object is nil"
> error
>
> <%= hidden_field_tag("game_id", @game.id) %>
Do you mean @game is nil? In that case you are not setting it up in
the controller.
Colin
>
> I thought the games id would automatically be passed to its nested
> resource, once I got my routings right, but I still can't pass the game
> objects id to my review table :/
>
> --
> 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.
>
>
--
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