OK, Solved it by not being outsmarting my baseline of dumbness

cart_item.rb

def product
  product = Product.find_by_mkt(product_mkt)
end

On Sep 24, 5:39 pm, isaac <[email protected]> wrote:
> I'm trying to connect two tables through :has_many, :through and using
> a foreign key which is not "_id". like this:
>
> cart.rb
>   has_many :cart_items
>   has_many :products, :through => :cart_items
>
> cart_item.rb
>   belongs_to :cart
>   belongs_to :product, :foreign_key => 'product_mkt'
>
> product.rb
>   has_many :cart_items
>   has_many :carts, :through => :cart_items
>
> for some reason, when I move from _id to _mkt, I can't use
> @cart.cart_item.product...
> instead I get "You have a nil object when you didn't expect it!" (as a
> respond to:)
>
> <repeat with="&[email protected]_items">
> ..
>       <td><view with="&this.product.name"/></td>
> ..
>
> "The error occurred while evaluating nil.name"
>
> is there any change I need to make for this connection to be useable?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to