Class: GroupsUsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- GroupsUsersController
- Defined in:
- app/controllers/groups_users_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /groups_users POST /groups_users.json.
-
#destroy ⇒ Object
DELETE /groups_users/1 DELETE /groups_users/1.json.
-
#edit ⇒ Object
GET /groups_users/1/edit.
-
#index ⇒ Object
GET /groups_users GET /groups_users.json.
-
#new ⇒ Object
GET /groups_users/new GET /groups_users/new.json.
-
#show ⇒ Object
GET /groups_users/1 GET /groups_users/1.json.
-
#update ⇒ Object
PUT /groups_users/1 PUT /groups_users/1.json.
Instance Method Details
#create ⇒ Object
POST /groups_users POST /groups_users.json
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/groups_users_controller.rb', line 48 def create #@groups_user = GroupsUser.new(params[:groups_user]) # #respond_to do |format| # if @groups_user.save # format.html { redirect_to groups_users_url, :notice => 'Groups user was successfully created.' } # format.json { render :json => @groups_user, :status => :created, :location => @groups_user } # else # format.html { render :action => "new" } # format.json { render :json => @groups_user.errors, :status => :unprocessable_entity } # end #end end |
#destroy ⇒ Object
DELETE /groups_users/1 DELETE /groups_users/1.json
80 81 82 83 84 85 86 87 88 |
# File 'app/controllers/groups_users_controller.rb', line 80 def destroy @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id]) @groups_user.destroy respond_to do |format| format.html { redirect_to groups_users_url } format.json { head :ok } end end |
#edit ⇒ Object
GET /groups_users/1/edit
40 41 42 43 44 |
# File 'app/controllers/groups_users_controller.rb', line 40 def edit @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id]) rescue raise CanCan::AccessDenied.new("Permission error") end |
#index ⇒ Object
GET /groups_users GET /groups_users.json
7 8 9 10 11 12 13 |
# File 'app/controllers/groups_users_controller.rb', line 7 def index @groups_users = GroupsUser.where(:group_id => @groups) respond_to do |format| format.html # index.html.erb format.json { render :json => @groups_users } end end |
#new ⇒ Object
GET /groups_users/new GET /groups_users/new.json
28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/groups_users_controller.rb', line 28 def new @groups_user = GroupsUser.new respond_to do |format| format.html # new.html.erb format.json { render :json => @groups_user } end rescue raise CanCan::AccessDenied.new("Permission error") end |
#show ⇒ Object
GET /groups_users/1 GET /groups_users/1.json
17 18 19 20 21 22 23 24 |
# File 'app/controllers/groups_users_controller.rb', line 17 def show @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @groups_user } end end |
#update ⇒ Object
PUT /groups_users/1 PUT /groups_users/1.json
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/controllers/groups_users_controller.rb', line 64 def update @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id]) respond_to do |format| if @groups_user.update_attributes(params[:groups_user]) format.html { redirect_to groups_users_url, :notice => 'Groups user was successfully updated.' } format.json { head :ok } else format.html { render :action => "edit" } format.json { render :json => @groups_user.errors, :status => :unprocessable_entity } end end end |