Class: AgentMergesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AgentMergesController
- Defined in:
- app/controllers/agent_merges_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /agent_merges POST /agent_merges.json.
-
#destroy ⇒ Object
DELETE /agent_merges/1 DELETE /agent_merges/1.json.
-
#edit ⇒ Object
GET /agent_merges/1/edit.
-
#index ⇒ Object
GET /agent_merges GET /agent_merges.json.
-
#new ⇒ Object
GET /agent_merges/new GET /agent_merges/new.json.
-
#show ⇒ Object
GET /agent_merges/1 GET /agent_merges/1.json.
-
#update ⇒ Object
PUT /agent_merges/1 PUT /agent_merges/1.json.
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
GET /agent_merges/1/edit
45 46 |
# File 'app/controllers/agent_merges_controller.rb', line 45 def edit end |
#index ⇒ Object
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 |
#new ⇒ Object
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 |
#show ⇒ Object
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 |
#update ⇒ Object
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 |