I think I got the whole matter now


If you want to show the cart then inherit "Spree::StoreController" rather
then "Spree::BaseController"


Thanks
On Thursday, June 21, 2012 12:12:28 PM UTC+2, A L wrote:

I'm trying to use the current_order method defined in the Spree::Core
engine:
https://github.com/spree/spree/blob/master/core/lib/spree/core/current_order.rb

In my view, I've tried

Spree::Core::CurrentOrder.current_order

Using just "current_order" in development works fine though, but not
in production.

So then I've tried to require it in my views file like this:

require 'spree/core/current_order'

I've also tried permutations of these other solutions:


http://stackoverflow.com/questions/11124447/how-to-incorporate-rails-engine-applicationcontroller-methods-in-a-main-app


http://stackoverflow.com/questions/7323327/a-way-to-add-before-filter-from-engine-to-application/


http://stackoverflow.com/questions/8797690/rails-3-1-better-way-to-expose-an-engines-helper-within-the-client-app

But I've lost track of what I actually did.

Can someone please point me in the right direction? Maybe I
implemented the solutions in the above links incorrectly?

This is the error I'm getting in production:

2012-06-21T09:59:08+00:00 app[web.1]: ActionView::Template::Error
(undefined method `current_order' for
Spree::Core::CurrentOrder:Module):

If I comment out the lines of code with current_order, everything
works in production.

I'm thinking it's the way things are loaded in production? But this is
the first time I'm trying to deploy so I don't quite understand the
differences between development and production.

Thanks in advance!
--

Search Discussions

  • Bionuc at Jan 16, 2013 at 8:11 am
    Hi A L,

    I was facing same problem trying to call "current_order" from my main
    application rather than calling it from spree mountable app
    I figured out the problem now

    My Controller was inherited from Spree::BaseController which has 3 helpers
    included except "Spree::Core::ControllerHelpers::Order" which has the
    helper method needed "current_order"

    To fix this, I needed to include this module in my controller and things
    went out fine

    I am still not sure why this module was not included in Base but just
    wanted to share this info with you

    Thanks
    On Thursday, June 21, 2012 12:12:28 PM UTC+2, A L wrote:

    I'm trying to use the current_order method defined in the Spree::Core
    engine:
    https://github.com/spree/spree/blob/master/core/lib/spree/core/current_order.rb

    In my view, I've tried

    Spree::Core::CurrentOrder.current_order

    Using just "current_order" in development works fine though, but not
    in production.

    So then I've tried to require it in my views file like this:

    require 'spree/core/current_order'

    I've also tried permutations of these other solutions:


    http://stackoverflow.com/questions/11124447/how-to-incorporate-rails-engine-applicationcontroller-methods-in-a-main-app


    http://stackoverflow.com/questions/7323327/a-way-to-add-before-filter-from-engine-to-application/


    http://stackoverflow.com/questions/8797690/rails-3-1-better-way-to-expose-an-engines-helper-within-the-client-app

    But I've lost track of what I actually did.

    Can someone please point me in the right direction? Maybe I
    implemented the solutions in the above links incorrectly?

    This is the error I'm getting in production:

    2012-06-21T09:59:08+00:00 app[web.1]: ActionView::Template::Error
    (undefined method `current_order' for
    Spree::Core::CurrentOrder:Module):

    If I comment out the lines of code with current_order, everything
    works in production.

    I'm thinking it's the way things are loaded in production? But this is
    the first time I'm trying to deploy so I don't quite understand the
    differences between development and production.

    Thanks in advance!
    --
  • A L at Jan 24, 2013 at 7:53 am
    Hi Bionuc,

    Thank you for the excellent info. I really appreciate you sharing it.
    Next time I come across something similar, this will definitely come
    in handy.

    Take care!

    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupspree-user @
categoriesrubyonrails
postedJan 16, '13 at 8:11a
activeJan 24, '13 at 7:53a
posts3
users2
websitespreecommerce.com
irc#RubyOnRails

2 users in discussion

Bionuc: 2 posts A L: 1 post

People

Translate

site design / logo © 2022 Grokbase