Sha256: d0a1becaa334bc987586909699b3d71503ca9ec06d4e103a6e8ec28e27765d40

Contents?: true

Size: 726 Bytes

Versions: 5

Compression:

Stored size: 726 Bytes

Contents

class UsersController < ApplicationController
  before_filter :require_no_user, :only => [:new, :create]
  before_filter :require_user, :only => [:show, :edit, :update]
  
  def new
    @user = User.new
  end
  
  def create
    @user = User.new(params[:user])
    if @user.save
      flash[:notice] = "Account registered!"
      redirect_to account_path
    else
      render :action => :new
    end
  end
  
  def show
    @user = @current_user
  end
  
  def edit
    @user = @current_user
  end
  
  def update
    @user = @current_user
    @user.attributes = params[:user]
    if @user.save
      flash[:notice] = "Account updated!"
      redirect_to account_path
    else
      render :action => :edit
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
authgasm-0.10.2 test_app/app/controllers/users_controller.rb
authgasm-0.10.0 test_app/app/controllers/users_controller.rb
authgasm-0.10.1 test_app/app/controllers/users_controller.rb
authgasm-0.9.1 test_app/app/controllers/users_controller.rb
authgasm-0.9.0 test_app/app/controllers/users_controller.rb