UsersController

Public Instance Methods

create() click to toggle source

POST /users POST /users.xml

    # File app/controllers/users_controller.rb, line 42
42:   def create

43:     @user = User.new(params[:user])

44: 

45:     respond_to do |format|

46:       if @user.save

47:         format.html { redirect_to(users_url,

48:                       :notice => "Uživatel #{@user.name} byl úspěšně vytvořený.") }

49:         format.xml  { render :xml => @user, :status => :created, :location => @user }

50:       else

51:         format.html { render :action => "new" }

52:         format.xml  { render :xml => @user.errors, :status => :unprocessable_entity }

53:       end

54:     end

55:   end
destroy() click to toggle source

DELETE /users/1 DELETE /users/1.xml

    # File app/controllers/users_controller.rb, line 75
75:   def destroy

76:     @user = User.find(params[:id])

77:     begin

78:       @user.destroy

79:       flash[:notice] = "Uživatel #{@user.name} byl odstraněný"

80:     rescue Exception => e

81:       flash[:notice] = e.message

82:     end

83: 

84:     respond_to do |format|

85:       format.html { redirect_to(users_url) }

86:       format.xml  { head :ok }

87:     end

88:   end
edit() click to toggle source

GET /users/1/edit

    # File app/controllers/users_controller.rb, line 36
36:   def edit

37:     @user = User.find(params[:id])

38:   end
index() click to toggle source

GET /users GET /users.xml

    # File app/controllers/users_controller.rb, line 4
 4:   def index

 5:     @users = User.order(:name)

 6: 

 7:     respond_to do |format|

 8:       format.html # index.html.erb

 9:       format.xml  { render :xml => @users }

10:     end

11:   end
new() click to toggle source

GET /users/new GET /users/new.xml

    # File app/controllers/users_controller.rb, line 26
26:   def new

27:     @user = User.new

28: 

29:     respond_to do |format|

30:       format.html # new.html.erb

31:       format.xml  { render :xml => @user }

32:     end

33:   end
show() click to toggle source

GET /users/1 GET /users/1.xml

    # File app/controllers/users_controller.rb, line 15
15:   def show

16:     @user = User.find(params[:id])

17: 

18:     respond_to do |format|

19:       format.html # show.html.erb

20:       format.xml  { render :xml => @user }

21:     end

22:   end
update() click to toggle source

PUT /users/1 PUT /users/1.xml

    # File app/controllers/users_controller.rb, line 59
59:   def update

60:     @user = User.find(params[:id])

61: 

62:     respond_to do |format|

63:       if @user.update_attributes(params[:user])

64:         format.html { redirect_to(users_url, :notice => 'Uživatel #{@user.name} byl úspěšně aktualizován.') }

65:         format.xml  { head :ok }

66:       else

67:         format.html { render :action => "edit" }

68:         format.xml  { render :xml => @user.errors, :status => :unprocessable_entity }

69:       end

70:     end

71:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.