On 4 September 2010 01:27, Pito Salas wrote:
> Here's an example:
>
> class LineItem < ActiveRecord::Base
> belongs_to :order
> end
>
> class Order < ActiveRecord::Base
> has_many :line_items
> end
>
> my_line_item = LineItem.find(:zipcode => "12345")
>
> Order.find_by_line_item(my_line_item) #
Here's an example:
class LineItem < ActiveRecord::Base
belongs_to :order
end
class Order < ActiveRecord::Base
has_many :line_items
end
my_line_item = LineItem.find(:zipcode => "12345")
Order.find_by_line_item(my_line_item) # doesn't work
Order.find_by_line_item_id (my_line_item) # does wor
2 matches
Mail list logo