Hi, I''m not sure if this is the right place to post this, but please redirect me if I''m posting this in the wrong place. I''m trying to use a method defined in an engine''s library, specifically it is the current_order method from 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. I''m not sure if it matters, but I''m deploying on Heroku. Thanks in advance! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/SXr427-hIlAJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Richard Schneeman
2012-Jun-21 23:12 UTC
Re: How to access an engine''s method from main application?
Hey Al, This list is used for talking about Rails internals for people who are contributing to the Rails framework directly. You will need to post this question to another list. Spree maintains a page with community support links http://spreecommerce.com/community or you can try posting to http://stackoverflow.com. Glad that you''re using Rails, hope you find an answer. -- Richard Schneeman http://heroku.com @schneems (http://twitter.com/schneems) On Thursday, June 21, 2012 at 3:12 PM, A L wrote:> Hi, > > I''m not sure if this is the right place to post this, but please redirect me if I''m posting this in the wrong place. > > I''m trying to use a method defined in an engine''s library, specifically it is the current_order method from 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 (http://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. I''m not sure if it matters, but I''m deploying on Heroku. > > Thanks in advance! > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/SXr427-hIlAJ. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Thanks Richard. Do you happen to know of any q&a forum specific for rails users? Thanks for the pointer! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/Mr8LRo2IrZ8J. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Ryan Bigg
2012-Jun-22 21:13 UTC
Re: How to access an engine''s method from main application?
rubyonrails-talk is that list. On Saturday, 23 June 2012 at 6:58 AM, A L wrote:> Thanks Richard. Do you happen to know of any q&a forum specific for rails users? > > Thanks for the pointer! > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/Mr8LRo2IrZ8J. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Thanks Ryan! :-) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/docf8k_s1yEJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.