Sha256: c5779405ebf3b4b233d5f73bba262b83a33a2366af9ab32a7c673667dd2106e0

Contents?: true

Size: 973 Bytes

Versions: 6

Compression:

Stored size: 973 Bytes

Contents

class UsersController < Spree::BaseController
  resource_controller
  
  before_filter :require_no_user, :only => [:new, :create]
  before_filter :require_user, :only => [:show, :edit, :update]
  before_filter :initialize_extension_partials
  ssl_required :new, :create, :edit, :update, :show
  
  actions :all, :except => [:index, :destroy]

  create do   
    flash nil
    wants.html { redirect_back_or_default products_path }
    wants.js { render :js => true.to_json }
    failure.wants.html { render :new }
    failure.wants.js { render :js => @user.errors.to_json }    
  end

  show.before do
    @orders = Order.checkout_completed(true).find_all_by_user_id(current_user.id)
  end

  def update
    @user = @current_user
    if @user.update_attributes(params[:user])
      flash[:notice] = t("account_updated")
      redirect_to account_url
    else
      render :action => :edit
    end
  end


  private
    def object
      @object ||= current_user
    end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
kdmny-spree-0.0.1 app/controllers/users_controller.rb
spree-0.8.4 app/controllers/users_controller.rb
spree-0.8.0 app/controllers/users_controller.rb
spree-0.8.1 app/controllers/users_controller.rb
spree-0.8.2 app/controllers/users_controller.rb
spree-0.8.3 app/controllers/users_controller.rb