Created
March 4, 2009 21:03
-
-
Save jashmenn/74002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Order | |
has_many :order_order_properties, :dependent => :destroy, | |
:attributes => true | |
has_many(:properties, :class_name => "OrderProperty", | |
:through => :order_order_properties, | |
:source => :order_property) | |
named_scope :with_property_value, lambda { |property_name, value| | |
{ | |
:include => [:properties, :order_order_properties], | |
:conditions => ['order_properties.name = ? AND order_order_properties.value = ?', property_name, value] | |
} | |
} | |
... | |
end | |
# orders = Order.with_property_value("order_motion_order_id", order_number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment