Souschef wrote:
> Interesting Alpha Blue, it does look like that.  Where might I be mis-
> referncing the object other than the myproject controller?

It can be an easy mistake to miss.

I found an old cart model a long time ago and for some strange reason, I 
saved it because it had this particular issue you are having.

cart.items.each_with_index do |item, index|
  item_id = Product.find_by_title(item.title)
  values.merge!({
      "amount_#{index+1}" => item.price,
      "item_name_#{index+1}" => item.title,
      "item_number_#{index+1}" => item_id,
      "quantity_#{index+1}" => item.quantity
    })
end

In this example, notice the item_id?  It was referencing the object_id 
instead of the id field.  When I changed it to:

cart.items.each_with_index do |item, index|
  item_id = Product.find_by_title(item.title)
  values.merge!({
      "amount_#{index+1}" => item.price,
      "item_name_#{index+1}" => item.title,
      "item_number_#{index+1}" => item_id.id,
      "quantity_#{index+1}" => item.quantity
    })
end

.. it referenced the correct id.  Keep in mind, this is a really old 
example and was something someone else built.

But, I would check anything in your controller or model that is 
referencing name_id instead of name.id and do some troubleshooting in 
your rails console since you haven't setup any test code for yourself.

-- 
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 post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to