Class: Profiles
- Defined in:
- app/controllers/profiles.rb
Instance Method Summary collapse
- #add_role ⇒ Object
- #all ⇒ Object
- #edit ⇒ Object
- #remove_role ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#add_role ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/profiles.rb', line 40 def add_role "add_#{params[:role]}_role" @user.add_role params[:role] @user.save! @user.reload flash[:info] = t :role_granted render action: :update end |
#all ⇒ Object
17 18 19 |
# File 'app/controllers/profiles.rb', line 17 def all @users = Models::User.all end |
#edit ⇒ Object
26 27 |
# File 'app/controllers/profiles.rb', line 26 def edit end |
#remove_role ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/profiles.rb', line 50 def remove_role "remove_#{params[:role]}_role" @user.remove_role params[:role] @user.save! @user.reload flash[:info] = t :role_removed render action: :update end |
#show ⇒ Object
21 22 |
# File 'app/controllers/profiles.rb', line 21 def show end |
#update ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/profiles.rb', line 29 def update access_denied if @user.anonymous? and !Models::User.current.admin? if @user.update_attributes params[:user] flash[:info] = t :user_updated # redirect_to action: :show else render action: :edit end end |