Class: Lentil::PhotographersController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
# File 'app/controllers/lentil/photographers_controller.rb', line 3

def index
  @photographers = User.joins(:images).where("state = 1").group('lentil_users.id').order(:user_name)
  @title = "Photographers"
end

#showObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/lentil/photographers_controller.rb', line 8

def show
  @images = Image.search(params[:page]).approved.where(:user_id => params[:id]).includes(:user).order("original_datetime DESC")


  if @images.empty?
    head :internal_server_error
  else
    @photographer = @images.first!.user
    @title = @photographer.user_name + " - Photographers"
  end
end