Class: Spree::UsersController
- Inherits:
-
StoreController
- Object
- StoreController
- Spree::UsersController
- Defined in:
- lib/controllers/frontend/spree/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/controllers/frontend/spree/users_controller.rb', line 14 def create @user = Spree::User.new(user_params) if @user.save if current_order session[:guest_token] = nil end redirect_back_or_default(root_url) else render :new end end |
#edit ⇒ Object
28 29 30 |
# File 'lib/controllers/frontend/spree/users_controller.rb', line 28 def edit load_object end |
#new ⇒ Object
7 |
# File 'lib/controllers/frontend/spree/users_controller.rb', line 7 def new; end |
#show ⇒ Object
9 10 11 12 |
# File 'lib/controllers/frontend/spree/users_controller.rb', line 9 def show load_object @orders = @user.orders.complete.order('completed_at desc') end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/controllers/frontend/spree/users_controller.rb', line 32 def update load_object if @user.update(user_params) spree_current_user.reload redirect_url = spree.account_url if params[:user][:password].present? # this logic needed b/c devise wants to log us out after password changes if Spree::Auth::Config[:signout_after_password_change] redirect_url = spree.login_url else bypass_sign_in(@user) end end redirect_to redirect_url, notice: I18n.t('spree.account_updated') else render :edit end end |