My question stems largely from and experience I just had. The theme I am
designing has a footer with a lot of links. I wanted to be able to make
changes to that block without having to commit a change to a view and push
it so I integrated the theme with the essential_cms plugin and using that
plugin to provide the content snippet for the layout. Being a good rails
dev, I wanted to put the load of the snippet into the controller to take
advantage of the caching. So I did the following:

Spree::BaseController.class_eval do before_filter :get_content_snippets def get_content_snippets return if request.path =~ /^\/+admin/ @content_snippets ||= Spree::Page.find_by_path("/content_snippets") endend


All was fine until I hit the pages the spree_auth_devise controllers and got 500 errors because they don't subclass Spree::BaseController. I have hacked around this in the meantime by decorating each of the auth_devise controller individually, but I would like to do something that is DRY. Is there a compelling reason NOT to have the spree_auth_devise controllers subclass the base controller?


Regards,


Nate

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/_PEHJr-em4sJ.
To post to this group, send email to spree-user@googlegroups.com.
To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

Search Discussions

  • Ryan Bigg at Dec 21, 2012 at 10:48 pm
    They need to subclass the devise controllers to get the Devise functionality.

    I would recommend adding that code to Spree::Core::ControllerHelpers instead.


    On 22/12/2012, at 6:32, Nate Lowrie wrote:

    My question stems largely from and experience I just had. The theme I am designing has a footer with a lot of links. I wanted to be able to make changes to that block without having to commit a change to a view and push it so I integrated the theme with the essential_cms plugin and using that plugin to provide the content snippet for the layout. Being a good rails dev, I wanted to put the load of the snippet into the controller to take advantage of the caching. So I did the following:

    Spree::BaseController.class_eval do

    before_filter :get_content_snippets

    def get_content_snippets
    return if request.path =~ /^\/+admin/
    @content_snippets ||= Spree::Page.find_by_path("/content_snippets")
    end

    end

    All was fine until I hit the pages the spree_auth_devise controllers and got 500 errors because they don't subclass Spree::BaseController. I have hacked around this in the meantime by decorating each of the auth_devise controller individually, but I would like to do something that is DRY. Is there a compelling reason NOT to have the spree_auth_devise controllers subclass the base controller?

    Regards,

    Nate
    --
    You received this message because you are subscribed to the Google Groups "Spree" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/_PEHJr-em4sJ.
    To post to this group, send email to spree-user@googlegroups.com.
    To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Spree" group.
    To post to this group, send email to spree-user@googlegroups.com.
    To unsubscribe from this group, send email to spree-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupspree-user @
categoriesrubyonrails
postedDec 21, '12 at 7:32p
activeDec 21, '12 at 10:48p
posts2
users2
websitespreecommerce.com
irc#RubyOnRails

2 users in discussion

Ryan Bigg: 1 post Nate Lowrie: 1 post

People

Translate

site design / logo © 2022 Grokbase