-
-
Save rlburkes/8825860 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 MarkProductExportsWhichMeetAllRequirements < ActiveRecord::Migration | |
class Export < ActiveRecord::Base | |
attr_accessible :meets_requirements | |
self.inheritance_column = nil | |
def meets_all_requirements? | |
# Do some complex business logic which cannot be expressed via sql query | |
end | |
end | |
def up | |
Export.where(type: 'ProductExport').find_each do |product_export| | |
product_export.update_attributes!(meets_requirements: product_export.meets_all_requirements?) | |
end | |
end | |
def down | |
# ... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment