Class: Cmtool::UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Cmtool::UsersController
- Defined in:
- app/controllers/cmtool/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
-
#index ⇒ Object
GET /cmtool/users.
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from ControllerGlue
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/cmtool/users_controller.rb', line 21 def create @user = ::User.new(user_params) if @user.save redirect_to cmtool.users_path, :notice => I18n.t('cmtool.action.create.successful', :model => ::User.model_name.human) else render :action => 'new' end end |
#destroy ⇒ Object
44 45 46 47 48 |
# File 'app/controllers/cmtool/users_controller.rb', line 44 def destroy @user = ::User.find(params[:id]) @user.destroy redirect_to cmtool.users_path, :notice => I18n.t('cmtool.action.destroy.successful', :model => ::User.model_name.human) end |
#edit ⇒ Object
13 14 15 |
# File 'app/controllers/cmtool/users_controller.rb', line 13 def edit @user = ::User.find(params[:id]) end |
#index ⇒ Object
GET /cmtool/users
5 6 7 |
# File 'app/controllers/cmtool/users_controller.rb', line 5 def index @users = ::User.all end |
#new ⇒ Object
17 18 19 |
# File 'app/controllers/cmtool/users_controller.rb', line 17 def new @user = ::User.new end |
#show ⇒ Object
9 10 11 |
# File 'app/controllers/cmtool/users_controller.rb', line 9 def show @user = ::User.find(params[:id]) end |
#update ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/cmtool/users_controller.rb', line 30 def update user = user_params unless user['password'].present? user.delete('password') user.delete('password_confirmation') end @user = ::User.find(params[:id]) if @user.update_attributes(user) redirect_to cmtool.users_path, :notice => I18n.t('cmtool.action.update.successful', :model => ::User.model_name.human) else render :action => 'edit' end end |