Class: UserGroupsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UserGroupsController
- Defined in:
- app/controllers/user_groups_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /user_groups POST /user_groups.json.
-
#destroy ⇒ Object
DELETE /user_groups/1 DELETE /user_groups/1.json.
-
#edit ⇒ Object
GET /user_groups/1/edit.
-
#index ⇒ Object
GET /user_groups GET /user_groups.json.
-
#new ⇒ Object
GET /user_groups/new.
-
#show ⇒ Object
GET /user_groups/1 GET /user_groups/1.json.
-
#update ⇒ Object
PUT /user_groups/1 PUT /user_groups/1.json.
Instance Method Details
#create ⇒ Object
POST /user_groups POST /user_groups.json
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/user_groups_controller.rb', line 42 def create @user_group = UserGroup.new(user_group_params) respond_to do |format| if @user_group.save format.html { redirect_to @user_group, notice: t('controller.successfully_created', model: t('activerecord.models.user_group')) } format.json { render json: @user_group, status: :created, location: @user_group } else format.html { render action: "new" } format.json { render json: @user_group.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /user_groups/1 DELETE /user_groups/1.json
79 80 81 82 83 84 85 86 |
# File 'app/controllers/user_groups_controller.rb', line 79 def destroy @user_group.destroy respond_to do |format| format.html { redirect_to user_groups_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /user_groups/1/edit
37 38 |
# File 'app/controllers/user_groups_controller.rb', line 37 def edit end |
#index ⇒ Object
GET /user_groups GET /user_groups.json
8 9 10 11 12 13 14 15 |
# File 'app/controllers/user_groups_controller.rb', line 8 def index @user_groups = UserGroup.order(:position) respond_to do |format| format.html # index.html.erb format.json { render json: @user_groups } end end |
#new ⇒ Object
GET /user_groups/new
27 28 29 30 31 32 33 34 |
# File 'app/controllers/user_groups_controller.rb', line 27 def new @user_group = UserGroup.new respond_to do |format| format.html # new.html.erb format.json { render json: @user_group } end end |
#show ⇒ Object
GET /user_groups/1 GET /user_groups/1.json
19 20 21 22 23 24 |
# File 'app/controllers/user_groups_controller.rb', line 19 def show respond_to do |format| format.html # show.html.erb format.json { render json: @user_group } end end |
#update ⇒ Object
PUT /user_groups/1 PUT /user_groups/1.json
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/user_groups_controller.rb', line 59 def update if params[:move] move_position(@user_group, params[:move]) return end respond_to do |format| if @user_group.update(user_group_params) format.html { redirect_to @user_group, notice: t('controller.successfully_updated', model: t('activerecord.models.user_group')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user_group.errors, status: :unprocessable_entity } end end end |