mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
Fix home page error with no photos.
This commit is contained in:
parent
b39549e348
commit
489edd2d2c
@ -1,5 +1,5 @@
|
|||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@photo = Photo.featured.order('RANDOM()').first
|
@photos = Photo.featured.order('RANDOM()').limit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
<%= render 'shared/photo_styles', photos: [@photo], size: 17 %>
|
<%= render 'shared/photo_styles', photos: @photos, size: 17 %>
|
||||||
|
|
||||||
<% content_for :navigation do %>
|
<% content_for :navigation do %>
|
||||||
<%= render 'shared/main_nav' %>
|
<%= render 'shared/main_nav' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @photo %>
|
<% if @photos.first.present? %>
|
||||||
<div class="sg-17 photo" id="<%= @photo.name.parameterize %>">
|
<div class="sg-17 photo" id="<%= @photos.first.name.parameterize %>">
|
||||||
<%= link_to_photo @photo %>
|
<%= link_to_photo @photos.first %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user