Ruby on Rails
Wednesday, August 20, 2014
On Wednesday, 20 August 2014 03:45:44 UTC-4, 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.
You're going to need to figure out why @line_item.expensescounter is nil. Post the code here if you need help finding the problem.
--Matt Jones
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/548491f4-2470-4a66-a878-aa5d31ee1157%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment