Class: Spree::TaxCategory
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
display_includes
#generate_permalink, #save_permalink
Class Method Details
.default ⇒ Object
25
26
27
|
# File 'app/models/spree/tax_category.rb', line 25
def self.default
find_by(is_default: true)
end
|
Instance Method Details
#ensure_one_default ⇒ Object
29
30
31
32
33
|
# File 'app/models/spree/tax_category.rb', line 29
def ensure_one_default
if is_default
Spree::TaxCategory.where(is_default: true).where.not(id: id).update_all(is_default: false, updated_at: Time.current)
end
end
|