Class: PatronMergesController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /patron_merges POST /patron_merges.json



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

def create
  @patron_merge = PatronMerge.new(params[:patron_merge])

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

#destroyObject

DELETE /patron_merges/1 DELETE /patron_merges/1.json



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

def destroy
  @patron_merge.destroy

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

#editObject

GET /patron_merges/1/edit



44
45
# File 'app/controllers/patron_merges_controller.rb', line 44

def edit
end

#indexObject

GET /patron_merges GET /patron_merges.json



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

def index
  if @patron
    @patron_merges = @patron.patron_merges.order('patron_merges.id').page(params[:page])
  elsif @patron_merge_list
    @patron_merges = @patron_merge_list.patron_merges.order('patron_merges.id').includes(:patron).page(params[:page])
  else
    @patron_merges = PatronMerge.page(params[:page])
  end

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

#newObject

GET /patron_merges/new GET /patron_merges/new.json



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

def new
  @patron_merge = PatronMerge.new
  @patron_merge.patron = @patron

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

#showObject

GET /patron_merges/1 GET /patron_merges/1.json



24
25
26
27
28
29
# File 'app/controllers/patron_merges_controller.rb', line 24

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

#updateObject

PUT /patron_merges/1 PUT /patron_merges/1.json



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

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