Created
July 23, 2013 13:51
-
-
Save orbanbotond/6062484 to your computer and use it in GitHub Desktop.
scopes for state_machine states
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
def Price.generate_scopes_for_state_machines | |
state_machines.each_pair do |machine_name, that_machine| | |
that_machine.states.map do |state| | |
# puts "will create these scopes: #{machine_name}_#{state.name} state: #{state.value} " | |
# puts "will create these scopes: #{machine_name}_#{state.name} state: #{state.name.to_s} " | |
# Price.scope "#{machine_name}_#{state.name}", :conditions => { machine_name => state.name.to_s } | |
Price.scope "#{machine_name}_#{state.name}", :conditions => { machine_name => state.value } | |
end | |
end | |
end | |
Price.generate_scopes_for_state_machines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment