[Rails] Re: Fail to pass id to foreign table

2013-04-17 Thread Ryo Saeba
my controller looks like this def create @game = Game.find_by_id(params[:id]) @review = current_user.reviews.build(params[:review]) @review.game_id = @game.id @review.user_id = current_user.id if @review.save flash[:success] = "review created!" redirect_to @revie

Re: [Rails] Re: Fail to pass id to foreign table

2013-04-17 Thread Colin Law
On 17 April 2013 12:37, Ryo Saeba 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| %> > > > Bu

[Rails] Re: Fail to pass id to foreign table

2013-04-17 Thread Ryo Saeba
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 ob

[Rails] Re: Fail to pass id to foreign table

2013-04-16 Thread Ryo Saeba
Update: Allright I tried this resources :games do member do get :followers end resources :reviews end (the member is for following purposes and has nothing to do with reviews) Now paths like "new_game_review_path" are generated, but now when I want to open a view, that c

[Rails] Re: Fail to pass id to foreign table

2013-04-16 Thread Ryo Saeba
oh you are right of course. well rake routes shows following: reviews_game GET/games/:id/reviews(.:format) games#reviews but I'm still confused, because this is the only route associated to my reviews, but shouldn't there be routes for "new" and "show" and "edit"? I thought I crea

Re: [Rails] Re: Fail to pass id to foreign table

2013-04-16 Thread Hassan Schroeder
On Tue, Apr 16, 2013 at 8:04 AM, Ryo Saeba wrote: > I tried the approach with nested resources, like this > > resources :games do > member do >:reviews > end > end > > but now my helper methods like "new_review_path" are not working. Why would you expect them to? Run `rake ro

[Rails] Re: Fail to pass id to foreign table

2013-04-16 Thread Ryo Saeba
All right. the show view of a single game has the url (games/:id). when I pste "debug @review" in the show view, it says that the review game_id has the id of the current game shown. Opening the review Form (which is the "new Method of the review controller), the debug result shows, that now t

Re: [Rails] Re: Fail to pass id to foreign table

2013-04-16 Thread Colin Law
On 16 April 2013 12:22, Ryo Saeba wrote: > All right, thanks for pointing that out. > > I simply used > <%= debug @review %> > > in my new-View of the reviews controller. > > Revieweing a game works by clicking on the "review" button in > "game#show". > > So having <%= debug @review %> in game#sho

[Rails] Re: Fail to pass id to foreign table

2013-04-16 Thread Ryo Saeba
All right, thanks for pointing that out. I simply used <%= debug @review %> in my new-View of the reviews controller. Revieweing a game works by clicking on the "review" button in "game#show". So having <%= debug @review %> in game#show, game_id receives it's proper id, but once I open the ne