Skip to content

Instantly share code, notes, and snippets.

@ddsilva
Last active October 7, 2015 19:11
Show Gist options
  • Select an option

  • Save ddsilva/9a67204cf165d530d3ec to your computer and use it in GitHub Desktop.

Select an option

Save ddsilva/9a67204cf165d530d3ec to your computer and use it in GitHub Desktop.
class Vehicle::QuoteExhibitionRule < ActiveRecord::Base
def activate!
return true if active
active_rule = self.class.active
active_rule.update(active: false) if active_rule
update_attribute :active, true
end
def self.active
find_by active: true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment