Showing posts with label spree. Show all posts
Showing posts with label spree. Show all posts

Monday, November 23, 2015

undefined local variable or method `try_spree_current_user'

If you create your custom spree controller,

beware that you will need to add in some spree controller helper to make the magic works

include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Store
include Spree::Core::ControllerHelpers::Order

or

you may extends from Spree::BaseController





Friday, September 12, 2014

overriding spree javascripts

to overwrite spree javascripts, such as spree.js.coffee.erb,

first , enable assets path in config/application.rb

add:
config.assets.paths << "#{Rails.root}/assets"

Next, copy the assets file to the same directory path as the assets on spree.
eg.
spree / core / app / assets / javascripts / spree.js.coffee.erb
to:
assets/javascripts/spree.js.coffee.erb

Then run this on server, if its in production mode:
bundle exec rake tmp:clear

then restart the server,
thin restart, or what ever server you are using. you may stop and start.


if you need to add more file, you may edit:
vendor/assets/javascripts/spree/frontend (or backend) / all.js

hope it helps :)

Tuesday, May 20, 2014

Spree new.before?

Spree has nifty callbacks for controller,
create.before
create.after
update.before,
but what about new.before?

new_action.before :method_name