Skip to content

Instantly share code, notes, and snippets.

@axsuul
Created August 29, 2012 08:52
Show Gist options
  • Save axsuul/3508751 to your computer and use it in GitHub Desktop.
Save axsuul/3508751 to your computer and use it in GitHub Desktop.
class OtoplastikCustomer < Customer
def otoplastik?
true
end
def prices(article)
query = lambda do |merchant_code|
OtoplastikArticlePrice.where("otoplastik_article_id = ? AND merchant_code = ?", article.id, merchant_code).order("minimum DESC")
end
prices = query.call(article.id)
prices = query.call(self.price_group) unless prices.exists?
prices = query.call(self.price_list) unless prices.exists?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment