Class: Spotlight::RolesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Spotlight::RolesController
- Defined in:
- app/controllers/spotlight/roles_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#index ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/controllers/spotlight/roles_controller.rb', line 7 def index # every admin should at least see themseleves raise CanCan::AccessDenied if @roles.empty? @exhibit.title, @exhibit t(:'spotlight.administration.sidebar.header'), exhibit_dashboard_path(@exhibit) t(:'spotlight.administration.sidebar.users'), exhibit_roles_path(@exhibit) @exhibit.roles.build end |
#update_all ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/spotlight/roles_controller.rb', line 16 def update_all attrs = params.require(:exhibit).permit(:roles_attributes => [:id, :user_key, :role, :_destroy]) any_deleted = (attrs[:roles_attributes], Role) if @exhibit.update(attrs) notice = any_deleted > 0 ? "User has been removed." : "User has been updated." redirect_to exhibit_roles_path(@exhibit), notice: notice else flash[:alert] = "There was a problem saving the users." render action: 'index' end end |