Displaying 1 result from an estimated 1 matches for "with_currency".
2011 Oct 12
1
scopes related question
Hello,
Have a question related scope definition. I need to define a scope
based on related model attribute values like this.
class Product < ActiveRecord::Base
belongs_to :currency
scope :with_currency, lambda { |currency|
unless currency.to_s.upcase == ''ALL''
# here I need to define a scope that would test for currency.char_code
to match a passed value
# something like.. This is where I need help
where("currency.char_code = ?", currency.to_s.upcase)
end...