Module: Handcart::Concerns::Handcarts::ClassMethods
- Defined in:
- app/models/handcart/concerns/handcarts.rb
Instance Method Summary collapse
-
#handcart_show_path(handcart) ⇒ Object
Try to formulate a path to view the handcart show page.
Instance Method Details
#handcart_show_path(handcart) ⇒ Object
Try to formulate a path to view the handcart show page
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/handcart/concerns/handcarts.rb', line 14 def handcart_show_path(handcart) if Handcart.handcart_show_path.present? # Load it straight from the config "/#{Handcart.handcart_show_path}/#{handcart.to_param}" else if Rails.application.routes.url_helpers.respond_to?("#{Handcart.handcart_class.model_name.singular}_path".to_sym) # Is there one already defined Rails.application.routes.url_helpers.send("#{Handcart.handcart_class.model_name.singular}_path", handcart.to_param) else # Shot in the dark "/#{Handcart.handcart_class.model_name.route_key}/#{handcart.to_param}" end end end |