Class: Addressbook::GroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/addressbook/groups_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_addressbook_account

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/addressbook/groups_controller.rb', line 16

def create
  @group = .groups.new(group_params)

  if @group.save
    redirect_to :back, notice: t('addressbook.group.create_notice')
  else
    render :new
  end
end

#destroyObject



38
39
40
# File 'app/controllers/addressbook/groups_controller.rb', line 38

def destroy
  @group.destroy
end

#editObject



26
27
28
# File 'app/controllers/addressbook/groups_controller.rb', line 26

def edit
  
end

#indexObject



8
9
10
# File 'app/controllers/addressbook/groups_controller.rb', line 8

def index
  @groups = Addressbook::Group.find(:all, params: { account_id: .id })
end

#newObject



12
13
14
# File 'app/controllers/addressbook/groups_controller.rb', line 12

def new
  @group = Addressbook::Group.new
end

#updateObject



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