Module: SolidusTaxCloud::Spree::ProductDecorator
- Defined in:
- app/decorators/models/solidus_tax_cloud/spree/product_decorator.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#tax_cloud_tic ⇒ Object
Use the store-default TaxCloud product TIC if none is defined for this product.
-
#tax_cloud_tic=(tic) ⇒ Object
Empty strings are written as nil (which avoids the format validation).
Class Method Details
.prepended(base) ⇒ Object
6 7 8 9 10 |
# File 'app/decorators/models/solidus_tax_cloud/spree/product_decorator.rb', line 6 def self.prepended(base) base.class_eval do validates_format_of :tax_cloud_tic, with: /\A\d{5}\z/, message: I18n.t('spree.standard_taxcloud_tic') end end |
Instance Method Details
#tax_cloud_tic ⇒ Object
Use the store-default TaxCloud product TIC if none is defined for this product
13 14 15 |
# File 'app/decorators/models/solidus_tax_cloud/spree/product_decorator.rb', line 13 def tax_cloud_tic read_attribute(:tax_cloud_tic) || ::Spree::Config.taxcloud_default_product_tic end |
#tax_cloud_tic=(tic) ⇒ Object
Empty strings are written as nil (which avoids the format validation)
18 19 20 |
# File 'app/decorators/models/solidus_tax_cloud/spree/product_decorator.rb', line 18 def tax_cloud_tic=(tic) write_attribute(:tax_cloud_tic, tic.presence) end |