Colin Law wrote in post #1155829: > Assuming the above is correct then what is LineItem.expensescounter? > Is it an association, so in the lineitem class you have lineitem > belongs_to Expensescounter or has_one Expensescounter? If so then at > some point you should have made an expensescounter and assigned it to > a lineitem object and saved them both in the database. Your error > suggests that the lineitem object in @line_item does not have an > associated expensescounter. So the code you need to show is how you > create the expensescounter and then give it to the lineitem. All you > have showed so far is a public method (current_expensescounter) which > finds or creates one, but there is nothing to say that it belongs to > the particular lineitem referenced by @lineitem.
In your last message, you given clue to solve this error. > Your error suggests that the lineitem object in @line_item does not have > an associated expensescounter This is main clue which help me to solve this error. By trying to solve this error i learn many things. Thank you very much to you for helping me and you spent valuable time. I solved this error because of you. Again Thank you very much. Warm regards. -- 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/62dd7b468932eebed8208f1963489eeb%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.