Class: UsersController
- Inherits:
-
BumbleController
- Object
- ActionController::Base
- BumbleController
- UsersController
- Defined in:
- app/controllers/users_controller.rb
Instance Method Summary collapse
- #activate ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#activate ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/users_controller.rb', line 49 def activate @user = User.find_using_perishable_token(params[:activation_code], 1.week) || (raise Exception) if @user.activate! @user.deliver_activation_confirmation! flash[:notice] = "Your account has been activated." UserSession.create(@user) redirect_to root_path else render :action => :new end end |
#create ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/users_controller.rb', line 38 def create @user = User.new(params[:user]) if @user.save_without_session_maintenance @user.deliver_activation_instructions! flash[:notice] = "Your account has been created. Please check your e-mail for your account activation instructions!" redirect_to login_path else render :action => :new end end |
#destroy ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/users_controller.rb', line 16 def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html do flash[:notice] = "User Deleted" redirect_to users_path end end end |
#edit ⇒ Object
8 9 10 |
# File 'app/controllers/users_controller.rb', line 8 def edit @user = User.find(params[:id]) end |
#index ⇒ Object
12 13 14 |
# File 'app/controllers/users_controller.rb', line 12 def index @users = User.paginate(:page => params[:page]) end |
#new ⇒ Object
4 5 6 |
# File 'app/controllers/users_controller.rb', line 4 def new @user = User.new end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/users_controller.rb', line 27 def update @user = User.find(params[:id]) @user.update_attributes(params[:user]) if @user.save flash[:notice] = 'User updated successfully' redirect_to posts_path else render :action => 'edit' end end |