Class: UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UsersController
- Defined in:
- 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
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/users_controller.rb', line 16 def create @user = User.new(params[:user]) if @user.save flash[:notice] = "Account registered!" redirect_back_or_default user_url(@user) else render :action => :new end end |
#destroy ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/users_controller.rb', line 42 def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to(users_url) } format.xml { head :ok } end end |
#edit ⇒ Object
30 31 |
# File 'app/controllers/users_controller.rb', line 30 def edit end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/users_controller.rb', line 8 def index @users = User.all end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/users_controller.rb', line 12 def new @user = User.new end |
#show ⇒ Object
26 27 28 |
# File 'app/controllers/users_controller.rb', line 26 def show require_user if @user.nil? end |
#update ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/users_controller.rb', line 33 def update if @user.update_attributes(params[:user]) flash[:notice] = "Account updated!" redirect_to user_url(@user) else render :action => :edit end end |