Class: Admin::SpeciesController

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

Instance Method Summary collapse

Instance Method Details

#indexObject

GET /species GET /species.xml


15
16
17
18
19
20
# File 'app/controllers/admin/species_controller.rb', line 15

def index
  @search = Species.includes(:animals).organization(current_user).search(params[:q])
  @species = @search.result.paginate(:page => params[:page], :per_page => 10).order("updated_at DESC")
  
  respond_with(@species)
end

#showObject

GET /species/1 GET /species/1.xml


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

def show
  @species = Species.find(params[:id])
  @animals = Animal.where(:species_id => @species.id).order("name ASC")
  
  respond_with(@species)
end