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/.

-- 
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/c9e818af5063a6b5c4b2b4deac0595c5%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to