Sha256: 2d5e67c796976fb8c011b9560ec0e61707a535ae1415f666761e7e067a38fbaa

Contents?: true

Size: 779 Bytes

Versions: 20

Compression:

Stored size: 779 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_back_or_default 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 # makes our views "cleaner" and more consistent
    if @user.update_attributes(params[:user])
      flash[:notice] = "Account updated!"
      redirect_to account_path
    else
      render :action => :edit
    end
  end
  
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
i0n_rails3_generators-0.2.19 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.18 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.17 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.16 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.15 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.14 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.13 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.12 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.11 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.10 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.9 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.8 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.7 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.6 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.5 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.4 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.3 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.2 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.1 lib/generators/authlogic/complete/templates/users_controller.rb
i0n_rails3_generators-0.2.0 lib/generators/authlogic/complete/templates/users_controller.rb