You are not passing the variable game to method 'email'. g = GameTrade.game_interest(user, game)
Don't you have to do this? g = GameTrade.game_interest(user, @game) Bruno Coelho Santiago On Sat, Mar 10, 2012 at 3:50 PM, Roger Patrick <li...@ruby-forum.com> wrote: > I am doing a web shop assignment and have got a problem with my action > mailer. > > I get an error undefined local variable or method 'game' > > I have the following in my mailer: > > def game_interest(user, game) > @user = user > @game = Game > mail :to => user.email, :subject => "Game Interest" > end > > and the following in my controller: > > def email > > @game = Game.find(params[:id]) > respond_to do |format| > user = @game.user > email = user.email > g = GameTrade.game_interest(user, game) > g.deliver > format.html { redirect_to root_url } > format.json { render json: @game } > end > end > > -- > 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 post to this group, send email to rubyonrails-talk@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.