Class: EtCms::Admin::UserController
- Inherits:
-
EtCms::AdminController
- Object
- ActionController::Base
- EtCms::ApplicationController
- EtCms::AdminController
- EtCms::Admin::UserController
- Defined in:
- app/controllers/et_cms/admin/user_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/et_cms/admin/user_controller.rb', line 12 def create @user = User.new(params[:user]) @user.password = 'password' @user.password_confirmation = 'password' if @user.save redirect_to(admin_user_index_url, :notice => 'User was successfully created.') else render :action => "new" end end |
#destroy ⇒ Object
40 41 42 43 44 45 46 |
# File 'app/controllers/et_cms/admin/user_controller.rb', line 40 def destroy @user = User.find(params[:id]) if @user.destroy flash[:notice] = "Successfully deleted User." redirect_to admin_user_index_url end end |
#edit ⇒ Object
24 25 26 |
# File 'app/controllers/et_cms/admin/user_controller.rb', line 24 def edit @user = User.find(current_user) end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/et_cms/admin/user_controller.rb', line 4 def index @users = User.all end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/et_cms/admin/user_controller.rb', line 8 def new @user = User.new end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/et_cms/admin/user_controller.rb', line 28 def update @user = User.find(current_user) params[:user].delete(:password) if params[:user][:password].blank? params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank? if @user.update_attributes(params[:user]) flash[:notice] = "Successfully updated User." redirect_to admin_user_index_url else render :action => 'edit' end end |