Module: Clearance::UsersController::InstanceMethods
- Defined in:
- lib/clearance/app/controllers/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/clearance/app/controllers/users_controller.rb', line 32 def create @user = User.new params[:user] if @user.save current_user = @user flash[:notice] = "User created and logged in." redirect_back_or root_url else render :action => "new" end end |
#destroy ⇒ Object
58 59 60 61 62 |
# File 'lib/clearance/app/controllers/users_controller.rb', line 58 def destroy @user = User.find params[:id] @user.destroy redirect_to root_url end |
#edit ⇒ Object
43 44 45 |
# File 'lib/clearance/app/controllers/users_controller.rb', line 43 def edit @user = User.find params[:id] end |
#index ⇒ Object
20 21 22 |
# File 'lib/clearance/app/controllers/users_controller.rb', line 20 def index @users = User.find :all end |
#new ⇒ Object
24 25 26 |
# File 'lib/clearance/app/controllers/users_controller.rb', line 24 def new @user = User.new end |
#show ⇒ Object
28 29 30 |
# File 'lib/clearance/app/controllers/users_controller.rb', line 28 def show @user = User.find params[:id] end |
#update ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/clearance/app/controllers/users_controller.rb', line 47 def update @user = User.find params[:id] if @user.update_attributes params[:user] flash[:notice] = "User updated." redirect_back_or root_url else render :action => "edit" end end |