Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

undefined local variable or method `current_store' #136

Open
xnjiang opened this issue Jun 29, 2015 · 4 comments
Open

undefined local variable or method `current_store' #136

xnjiang opened this issue Jun 29, 2015 · 4 comments

Comments

@xnjiang
Copy link

xnjiang commented Jun 29, 2015

I am using spree with existing user model. After follow the instruction here:
https://guides.spreecommerce.com/developer/authentication.html

I installed your gem, but I got this error:

undefined local variable or method `current_store' for #<WelcomesController:0x007fe415e475b8>

WelcomesController not need devise auth and can be view by anyone.

Here is part of log:

Started GET "/" for 127.0.0.1 at 2015-06-29 15:56:36 +0800
  ActiveRecord::SchemaMigration Load (0.6ms)  SELECT "schema_migrations".* FROM "schema_migrations"
Processing by WelcomesController#index as HTML
Completed 500 Internal Server Error in 15ms (ActiveRecord: 0.0ms)

NameError (undefined local variable or method `current_store' for #<WelcomesController:0x007fe415e475b8>):
  /Users/jiangxin/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bundler/gems/spree-multi-domain-3bd641f7b354/lib/spree_multi_domain/multi_domain_helpers.rb:23:in `add_current_store_id_to_params'
  activesupport (4.2.1) lib/active_support/callbacks.rb:432:in `block in make_lambda'
  activesupport (4.2.1) lib/active_support/callbacks.rb:164:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:164:in `block in halting'
  activesupport (4.2.1) lib/active_support/callbacks.rb:504:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:504:in `block in call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:504:in `each'
  activesupport (4.2.1) lib/active_support/callbacks.rb:504:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:92:in `_run_callbacks'
...

After I added this to application controller, I can access the app but store is empty.

  def current_store
    Spree::Store.first
  end

Did I miss something?

Thanks!

@raulperezalejo
Copy link

i am having this same issue. did you solve it with out having to put that method in the app controller?
regards

@damonYuan
Copy link

I have make a pull request, please check

@ronzalo
Copy link

ronzalo commented Jul 13, 2017

Your WelcomesController should inherit from Spree::StoreController

@waleolakareem
Copy link

@ronzalo Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants