Class: Admin::AnimalColorsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject

GET /animal_colors GET /animal_colors.xml


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

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

#showObject

GET /animal_colors/1 GET /animal_colors/1.xml


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

def show
  @animal_color = AnimalColor.find(params[:id])
  @animals = Animal.where(:animal_color_id => @animal_color.id).order("name ASC")
  
  respond_with(@animal_color)
end