Skip to content

Instantly share code, notes, and snippets.

@radar
Created August 29, 2012 08:50
Show Gist options
  • Select an option

  • Save radar/3508742 to your computer and use it in GitHub Desktop.

Select an option

Save radar/3508742 to your computer and use it in GitHub Desktop.
class OtoplastikCustomer < Customer
def otoplastik?
true
end
def find_prices(article_id, merchant_id)
OtoplastikArticlePrice.where("otoplastik_article_id = ? AND merchant_code = ?", article.id, self.id).order("minimum DESC")
end
def prices(article)
prices = find_prices(article.id, self.id)
unless prices.exists?
prices = find_prices(article.id, self.price_group)
end
unless prices.exists?
prices = find_prices(article.id, self.price_list)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment