Sha256: 002adc380aee018440dc0314374ffc94b4f898be6089895799ba993035b42050

Contents?: true

Size: 631 Bytes

Versions: 2

Compression:

Stored size: 631 Bytes

Contents

class Sprangular::AccountsController < Sprangular::BaseController
  before_filter :check_authorization, except: :create

  def create
    @user = Spree::User.create(spree_user_params)

    sign_in(:spree_user, @user) if @user.persisted?
    @order = current_order

    render 'show'
  end

  def show
    authorize! :show, @user
    @order = current_order
  end

  def update
    authorize! :update, @user
    @user.update_attributes spree_user_params
    @order = current_order

    render 'show'
  end

private

  def spree_user_params
    params.require(:spree_user).permit(Spree::PermittedAttributes.user_attributes)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sprangular-0.1.0 app/controllers/sprangular/accounts_controller.rb
sprangular-0.0.1 app/controllers/sprangular/accounts_controller.rb