Class: Addressbook::GroupsController
Instance Method Summary
collapse
#current_addressbook_account
Instance Method Details
#create ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/addressbook/groups_controller.rb', line 16
def create
@group = current_addressbook_account.groups.new(group_params)
if @group.save
redirect_to :back, notice: t('addressbook.group.create_notice')
else
render :new
end
end
|
#destroy ⇒ Object
38
39
40
|
# File 'app/controllers/addressbook/groups_controller.rb', line 38
def destroy
@group.destroy
end
|
#edit ⇒ Object
26
27
28
|
# File 'app/controllers/addressbook/groups_controller.rb', line 26
def edit
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/addressbook/groups_controller.rb', line 8
def index
@groups = Addressbook::Group.find(:all, params: { account_id: current_addressbook_account.id })
end
|
#new ⇒ Object
12
13
14
|
# File 'app/controllers/addressbook/groups_controller.rb', line 12
def new
@group = Addressbook::Group.new
end
|
#update ⇒ Object
30
31
32
33
34
35
36
|
# File 'app/controllers/addressbook/groups_controller.rb', line 30
def update
if @group.update_attributes(group_params)
redirect_to :back, notice: t('addressbook.group.update_notice')
else
render :edit
end
end
|