Class: Bolt::UsersGroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/bolt/users_groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /bolt/users_groups POST /bolt/users_groups.json



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/bolt/users_groups_controller.rb', line 43

def create
  @users_group = UsersGroup.new(params[:users_group])

  respond_to do |format|
    if @users_group.save
      format.html { redirect_to @users_group, :notice => 'Users group was successfully created.' }
      format.json { render :json => @users_group, :status => :created, :location => @users_group }
    else
      format.html { render :action => "new" }
      format.json { render :json => @users_group.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /bolt/users_groups/1 DELETE /bolt/users_groups/1.json



75
76
77
78
79
80
81
82
83
# File 'app/controllers/bolt/users_groups_controller.rb', line 75

def destroy
  @users_group = UsersGroup.find(params[:id])
  @users_group.destroy

  respond_to do |format|
    format.html { redirect_to users_groups_url }
    format.json { head :ok }
  end
end

#destroy_multipleObject



85
86
87
88
89
90
91
92
93
94
95
96
# File 'app/controllers/bolt/users_groups_controller.rb', line 85

def destroy_multiple
  ids= params[:id]
  idarr=ids.split(',')
  idarr.each do |del|
   @users_group = UsersGroup.find(del)
   @users_group.destroy
 end
 respond_to do |format|
   format.html { redirect_to :back  }
   # format.json { head :ok }
 end
end

#editObject

GET /bolt/users_groups/1/edit



37
38
39
# File 'app/controllers/bolt/users_groups_controller.rb', line 37

def edit
  @users_group = UsersGroup.find(params[:id])
end

#indexObject

GET /bolt/users_groups GET /bolt/users_groups.json



5
6
7
8
9
10
11
12
# File 'app/controllers/bolt/users_groups_controller.rb', line 5

def index
  @users_groups = UsersGroup.all

  respond_to do |format|
    format.html # index.html.erb
    format.json { render :json => @users_groups }
  end
end

#newObject

GET /bolt/users_groups/new GET /bolt/users_groups/new.json



27
28
29
30
31
32
33
34
# File 'app/controllers/bolt/users_groups_controller.rb', line 27

def new
  @users_group = UsersGroup.new

  respond_to do |format|
    format.html # new.html.erb
    format.json { render :json => @users_group }
  end
end

#showObject

GET /bolt/users_groups/1 GET /bolt/users_groups/1.json



16
17
18
19
20
21
22
23
# File 'app/controllers/bolt/users_groups_controller.rb', line 16

def show
  @users_group = UsersGroup.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.json { render :json => @users_group }
  end
end

#updateObject

PUT /bolt/users_groups/1 PUT /bolt/users_groups/1.json



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/controllers/bolt/users_groups_controller.rb', line 59

def update
  @users_group = UsersGroup.find(params[:id])

  respond_to do |format|
    if @users_group.update_attributes(params[:users_group])
      format.html { redirect_to @users_group, :notice => 'Users group was successfully updated.' }
      format.json { head :ok }
    else
      format.html { render :action => "edit" }
      format.json { render :json => @users_group.errors, :status => :unprocessable_entity }
    end
  end
end