Created
September 13, 2012 09:52
-
-
Save rimian/3713300 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
# Doesn't work when code = nil because the operator in the SQL should be 'is' not '=' | |
def shipping_options | |
if @promotion.present? | |
code = @promotion.code | |
else | |
code = nil | |
end | |
Shipping.where('promotion_code = ? AND is_bulky = ? AND minimum_spend <= ?', | |
code, self.bulky_order?, self.calculate_total_price.to_f) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
something like this:
Shipping.where(:promotion_code => '').where(:price => 0.0)