Class: BetterRailsDebugger::AnalysisGroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/better_rails_debugger/analysis_groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
# File 'app/controllers/better_rails_debugger/analysis_groups_controller.rb', line 24

def create
  @group = AnalysisGroup.new analysis_group_params
  if @group.save
    redirect_to analysis_groups_path, notice: 'Successfully created!'
  else
    flash.now[:error] = @group.errors.full_messages
    render 'new'
  end
end

#destroyObject



55
56
57
58
59
60
61
62
# File 'app/controllers/better_rails_debugger/analysis_groups_controller.rb', line 55

def destroy
  if !@group
    redirect_to analysis_groups_path, notice: 'Analysis group not found'
    return
  end
  @group.destroy
  redirect_to analysis_groups_path, notice: 'Analysis group destroyed'
end

#editObject



34
35
36
37
38
39
# File 'app/controllers/better_rails_debugger/analysis_groups_controller.rb', line 34

def edit
  if !@group
    redirect_to analysis_groups_path, notice: 'Analysis group not found'
    return
  end
end

#indexObject



8
9
10
# File 'app/controllers/better_rails_debugger/analysis_groups_controller.rb', line 8

def index
  @groups = AnalysisGroup.order(name: 'asc').limit(20).paginate(page: (params[:page] || 1), per_page: 20)
end

#newObject



20
21
22
# File 'app/controllers/better_rails_debugger/analysis_groups_controller.rb', line 20

def new
  @group = AnalysisGroup.new
end

#showObject



12
13
14
15
16
17
18
# File 'app/controllers/better_rails_debugger/analysis_groups_controller.rb', line 12

def show
  if !@group
    redirect_to analysis_groups_path, notice: 'Analysis group not found'
    return
  end
  @instances = @group.group_instances.order(created_at: 'desc').limit(20).paginate(page: (params[:page] || 1), per_page: 20)
end

#updateObject



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/better_rails_debugger/analysis_groups_controller.rb', line 41

def update
  if !@group
    redirect_to analysis_groups_path, notice: 'Analysis group not found'
    return
  end
  if @group.update_attributes(analysis_group_params)
    redirect_to analysis_groups_path, notice: 'Updated successfully'
    return
  else
    flash.now[:error] = @group.errors.full_messages
    render 'edit'
  end
end