Class: FamilyGallery::GroupsController
Instance Method Summary
collapse
#current_ability, #current_user
Instance Method Details
#create ⇒ Object
20
21
22
23
24
25
26
|
# File 'app/controllers/family_gallery/groups_controller.rb', line 20
def create
if @group.save
redirect_to @group
else
render :new
end
end
|
#destroy ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'app/controllers/family_gallery/groups_controller.rb', line 39
def destroy
if @group.destroy
redirect_to groups_url
else
flash[:error] = @group.errors.full_messages.join(". ")
redirect_to @group
end
end
|
#edit ⇒ Object
28
29
|
# File 'app/controllers/family_gallery/groups_controller.rb', line 28
def edit
end
|
#index ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'app/controllers/family_gallery/groups_controller.rb', line 4
def index
@ransack_values = params[:q] || {}
@ransack = FamilyGallery::Group.ransack(@ransack_values)
@groups = @ransack.result.accessible_by(current_ability)
@groups = @groups.order(:id) unless @ransack_values[:s]
@groups = @groups.page(params[:page])
@groups = @groups.select { |group| can?(:show, group) }
end
|
#new ⇒ Object
17
18
|
# File 'app/controllers/family_gallery/groups_controller.rb', line 17
def new
end
|
#show ⇒ Object
14
15
|
# File 'app/controllers/family_gallery/groups_controller.rb', line 14
def show
end
|
#update ⇒ Object
31
32
33
34
35
36
37
|
# File 'app/controllers/family_gallery/groups_controller.rb', line 31
def update
if @group.update_attributes(group_params)
redirect_to @group
else
render :edit
end
end
|