Hi Spree, I'm working with Spree 2.1.1 and I thought this was odd:

2.0.0p247 :001 > s = Spree::BaseController.new
=> #<Spree::BaseController:0x007fea498ecbb0 @_routes=nil,
@_action_has_layout=true, @_headers={"Content-Type"=>"text/html"},
@_status=200, @_request=nil, @_response=nil>
*2.0.0p247 :002 > s.respond_to?(:current_order) #=> false*
*
*
2.0.0p247 :001 > Spree::BaseController.class_eval do
                              include Spree::Core::ControllerHelpers::Order
                           end

2.0.0p247 :004 > s = Spree::BaseController.new
=> #<Spree::BaseController:0x007fea4a88eeb0 @_routes=nil,
@_action_has_layout=true, @_headers={"Content-Type"=>"text/html"},
@_status=200, @_request=nil, @_response=nil>
*2.0.0p247 :005 > s.respond_to?(:current_order) #=> true*

Is there a reason why this isn't being included? Am I missing the idea
behind including these helpers which seem to me should be part of the
controller in all occasions?

Search Discussions

  • Ryan Bigg at Oct 8, 2013 at 11:10 pm
    That helper is actually included into a subclass of Spree::BaseController,
    called Spree::StoreController;
    https://github.com/spree/spree/blob/c6bc653535a71e6c73c586fb59ab9baacd41a4a6/frontend/app/controllers/spree/store_controller.rb#L3

    The reason for this is because Spree::BaseController is the absolute bare
    necessity for Spree's controllers, and Spree::StoreController adds a couple
    of extra things for the controllers that need that.

    You'll probably want to use Spree::StoreController.

    On Wed, Oct 9, 2013 at 4:08 AM, Tim Case wrote:

    Hi Spree, I'm working with Spree 2.1.1 and I thought this was odd:

    2.0.0p247 :001 > s = Spree::BaseController.new
    => #<Spree::BaseController:0x007fea498ecbb0 @_routes=nil,
    @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"},
    @_status=200, @_request=nil, @_response=nil>
    *2.0.0p247 :002 > s.respond_to?(:current_order) #=> false*
    *
    *
    2.0.0p247 :001 > Spree::BaseController.class_eval do
    include Spree::Core::ControllerHelpers::Order
    end

    2.0.0p247 :004 > s = Spree::BaseController.new
    => #<Spree::BaseController:0x007fea4a88eeb0 @_routes=nil,
    @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"},
    @_status=200, @_request=nil, @_response=nil>
    *2.0.0p247 :005 > s.respond_to?(:current_order) #=> true*

    Is there a reason why this isn't being included? Am I missing the idea
    behind including these helpers which seem to me should be part of the
    controller in all occasions?


    --

    Ryan Bigg
    Community Manager
    Spree Commerce, Inc.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupspree-user @
categoriesrubyonrails
postedOct 8, '13 at 5:08p
activeOct 8, '13 at 11:10p
posts2
users2
websitespreecommerce.com
irc#RubyOnRails

2 users in discussion

Ryan Bigg: 1 post Tim Case: 1 post

People

Translate

site design / logo © 2022 Grokbase