Module: Stall::Addressable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/stall/addressable.rb
Instance Method Summary collapse
-
#billing_address ⇒ Object
Allow billing address to fall back to shipping address when not filled.
- #billing_address? ⇒ Boolean
-
#shipping_address ⇒ Object
Allow shipping address to fall back to billing address when not filled.
- #shipping_address? ⇒ Boolean
Instance Method Details
#billing_address ⇒ Object
Allow billing address to fall back to shipping address when not filled
25 26 27 28 |
# File 'lib/stall/addressable.rb', line 25 def billing_address association(:billing_address).load_target || association(:shipping_address).load_target end |
#billing_address? ⇒ Boolean
30 31 32 |
# File 'lib/stall/addressable.rb', line 30 def billing_address? billing_address.try(:persisted?) && billing_address.billing? end |
#shipping_address ⇒ Object
Allow shipping address to fall back to billing address when not filled
35 36 37 38 |
# File 'lib/stall/addressable.rb', line 35 def shipping_address association(:shipping_address).load_target || association(:billing_address).load_target end |
#shipping_address? ⇒ Boolean
40 41 42 |
# File 'lib/stall/addressable.rb', line 40 def shipping_address? shipping_address.try(:persisted?) && shipping_address.shipping? end |