Module: HasTrolleyControllerHelpersOverrides::UrlFor
- Defined in:
- lib/kete_gets_trollied/has_trolley_controller_helpers_overrides.rb
Instance Method Summary collapse
-
#url_for_order(options = { }) ⇒ Object
expects order either as instance variables or in options.
-
#url_for_trolley(options = { }) ⇒ Object
expects user in options or @user or trolley being set unless @purchasable_item is present WARNING: in the case of @purchasable_item this method name breaks the principle of least surprise maybe alter trollied gem in future to come right.
Instance Method Details
#url_for_order(options = { }) ⇒ Object
expects order either as instance variables or in options
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/kete_gets_trollied/has_trolley_controller_helpers_overrides.rb', line 36 def url_for_order( = { }) trolley = .delete(:trolley) || @trolley trolley = @order.trolley if @order order = .delete(:order) || @order || trolley.selected_order [:id] = order [:controller] = 'orders' [:action] = 'show' [:urlified_name] = Basket.site_basket.urlified_name url_for end |
#url_for_trolley(options = { }) ⇒ Object
expects user in options or @user or trolley being set unless @purchasable_item is present WARNING: in the case of @purchasable_item this method name breaks the principle of least surprise maybe alter trollied gem in future to come right
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kete_gets_trollied/has_trolley_controller_helpers_overrides.rb', line 14 def url_for_trolley( = { }) return url_for_dc_identifier(@purchasable_item) if @purchasable_item && params[:action] == 'create' user = .delete(:user) trolley = [:trolley] || @trolley || user.trolley if trolley.blank? user = @user else user = trolley.user end [:user_id] = user.id [:controller] = 'trolleys' [:action] = 'show' [:urlified_name] = Basket.site_basket.urlified_name url = url_for() # .split(".%23%")[0] end |