Class: UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UsersController
- Defined in:
- lib/generators/lab/setup/templates/devise/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
16 17 18 19 20 21 22 23 |
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 16 def create @user = User.new(params[:user]) if @user.save redirect_to(users_url, :notice => "User created with success.") else render :new end end |
#destroy ⇒ Object
38 39 40 41 42 |
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 38 def destroy @user = User.find(params[:id]) @user.destroy redirect_to(users_url, :notice => "User deleted with success.") end |
#edit ⇒ Object
25 26 27 |
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 25 def edit @user = User.find(params[:id]) end |
#index ⇒ Object
4 5 6 |
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 4 def index @users = User.all(:conditions => search_conditions) end |
#new ⇒ Object
12 13 14 |
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 12 def new @user = User.new end |
#show ⇒ Object
8 9 10 |
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 8 def show @user = User.find(params[:id]) end |
#update ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/generators/lab/setup/templates/devise/users_controller.rb', line 29 def update @user = User.find(params[:id]) if @user.update_attributes(params[:user]) redirect_to(users_url, :notice => "User updated with success.") else render :edit end end |