Class: GalleriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/galleries_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/galleries_controller.rb', line 5

def index

  if params[:tag]
    @search = Gallery.tagged_with(params[:tag]).list_all.search(params[:search])
    @galleries = @search.all
  else
    @search = Gallery.list_all.search(params[:search])
    @galleries = @search.all
  end

  respond_with @galleries
end

#showObject



18
19
20
21
22
23
# File 'app/controllers/galleries_controller.rb', line 18

def show
  @gallery = Gallery.find(params[:id])
  @gallery.visit! :by => request.try(:remote_ip)

  respond_with @gallery
end