Class: Admin::RelinquishAnimalsController

Inherits:
CrudController
  • Object
show all
Defined in:
app/controllers/admin/relinquish_animals_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

# POST /biters # POST /biters.xml


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/admin/relinquish_animals_controller.rb', line 11

def create
  @relinquish_animal = RelinquishAnimal.new(relinquish_animal_params)

  respond_to do |format|
    if @relinquish_animal.save!
      format.html { 
        redirect_to(:back, :notice => 'Animal successfully added.')
        }
      format.xml  { render :xml => @relinquish_animal, :status => :created, :location => @relinquish_animal }
    else
      format.html { render "new" }
      format.xml  { render :xml => @relinquish_animal.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /biters/1 DELETE /biters/1.xml


29
30
31
32
33
34
# File 'app/controllers/admin/relinquish_animals_controller.rb', line 29

def destroy
  @relinquish_animal = RelinquishAnimal.find_by_animal_id_and_relinquishment_contact_id(params[:id], params[:relinquish])
  @relinquish_animal.destroy

  redirect_to(:back, :notice => 'Animal successfully removed.')
end