On Wednesday, August 20, 2014 9:45:44 AM UTC+2, Ruby-Forum.com User wrote: > > I am using Ruby 1.9.3 and Rails 3.2.16. I follow "Agile web development > with rails" book. > > I am trying to make **Expense Management** application. > > I am providing Heroku links as follow: > " https://expense-management-app.herokuapp.com/manageexpense " > > In above link, When I click on "Add to count" button then I can able to > redirect to > > "https://expense-management-app.herokuapp.com/expensescounters/6" > > this link. It is working. > > Now i create association between user and expensescounter to see the > expenses for authorize user. > > >>After creating association, when I click on "Add to count" button, I got > error > like: > > ActionController::ActionControllerError (Cannot redirect to nil!): > > app/controllers/line_items_controller.rb:54:in `block (2 levels) in > create' > > app/controllers/line_items_controller.rb:51:in `create' > > >> Code of line_items_controller.rb : > > def create > @expensescounter = current_expensescounter > quantity = Quantity.find(params[:quantity_id]) > @line_item = @expensescounter.add_quantity(quantity.id) > @line_item.quantity = quantity > > respond_to do |format| #line no. : 51 > if @line_item.save > format.html { redirect_to @line_item.expensescounter } #line no. : > 54 > . > . > . > . > . > end > > How can I solve this problem? > > Any help would be appreciated. > > -- > Posted via http://www.ruby-forum.com/. >
Can you create a gist with the code to repsoduce the error or post the full error stack trace, please ? -- 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+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e6a2819a-4331-4a97-9560-eec16ce78bd8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.