On May 9, 7:12 am, Ahmed Khademzadeh <[email protected]> wrote:
> Hi all,
>
> on page 151 of the book agile... we have the following code in the
> file order.rb:
>
> def add_line_items_from_cart(cart)
> cart.items.each do |item|
> li = LineItem.from_cart_item(item)
> line_items << li
> end
>
> what kind of variable is line_items? is it a local, class, instance or
> other kind of variable?
Assuming the code is correct (you're missing an 'end' for starters),
the only way this could work were if line_items were a method
returning an appropriate object.
Fred
> if it is local how rails saves the contents of this variable when
> saves the order in "save_order" method which is place in the file
> "store_controller.rb"?
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---