Created
November 27, 2014 10:38
-
-
Save puneetpandey/25de4fd04a82ad0937a6 to your computer and use it in GitHub Desktop.
This file contains 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 Product < ActiveRecord::Base | |
has_many :suppliers, conditions: ["suppliers.status = ?", true] | |
end | |
# In Rails4, if you wish to use the same, you can use the below syntax: | |
class Product < ActiveRecord::Base | |
has_many :suppliers, -> { where("suppliers.status = ?", true) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment