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
27
28
29
|
# File 'app/models/spree/tax_category.rb', line 27
def self.default
find_by(is_default: true)
end
|
Instance Method Details
#ensure_one_default ⇒ Object
31
32
33
34
35
|
# File 'app/models/spree/tax_category.rb', line 31
def ensure_one_default
if is_default
Spree::TaxCategory.where(is_default: true).where.not(id:).update_all(is_default: false, updated_at: Time.current)
end
end
|