Class: AgentMergesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/agent_merges_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /agent_merges POST /agent_merges.json



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'app/controllers/agent_merges_controller.rb', line 50

def create
  @agent_merge = AgentMerge.new(agent_merge_params)

  respond_to do |format|
    if @agent_merge.save
      format.html { redirect_to(@agent_merge, notice: t('controller.successfully_created', model: t('activerecord.models.agent_merge'))) }
      format.json { render json: @agent_merge, status: :created, location: @agent_merge }
    else
      format.html { render action: "new" }
      format.json { render json: @agent_merge.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /agent_merges/1 DELETE /agent_merges/1.json



80
81
82
83
84
85
86
87
# File 'app/controllers/agent_merges_controller.rb', line 80

def destroy
  @agent_merge.destroy

  respond_to do |format|
    format.html { redirect_to(agent_merges_url) }
    format.json { head :no_content }
  end
end

#editObject

GET /agent_merges/1/edit



45
46
# File 'app/controllers/agent_merges_controller.rb', line 45

def edit
end

#indexObject

GET /agent_merges GET /agent_merges.json



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/agent_merges_controller.rb', line 8

def index
  if @agent
    @agent_merges = @agent.agent_merges.order('agent_merges.id').page(params[:page])
  elsif @agent_merge_list
    @agent_merges = @agent_merge_list.agent_merges.order('agent_merges.id').includes(:agent).page(params[:page])
  else
    @agent_merges = AgentMerge.page(params[:page])
  end

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

#newObject

GET /agent_merges/new GET /agent_merges/new.json



34
35
36
37
38
39
40
41
42
# File 'app/controllers/agent_merges_controller.rb', line 34

def new
  @agent_merge = AgentMerge.new
  @agent_merge.agent = @agent

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

#showObject

GET /agent_merges/1 GET /agent_merges/1.json



25
26
27
28
29
30
# File 'app/controllers/agent_merges_controller.rb', line 25

def show
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @agent_merge }
  end
end

#updateObject

PUT /agent_merges/1 PUT /agent_merges/1.json



66
67
68
69
70
71
72
73
74
75
76
# File 'app/controllers/agent_merges_controller.rb', line 66

def update
  respond_to do |format|
    if @agent_merge.update(agent_merge_params)
      format.html { redirect_to(@agent_merge, notice: t('controller.successfully_updated', model: t('activerecord.models.agent_merge'))) }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @agent_merge.errors, status: :unprocessable_entity }
    end
  end
end