master
1class CakesController < ApplicationController
2 def initialize(repository = Spank::IOC.resolve(:cakes))
3 @repository = repository
4 super()
5 end
6
7 def index
8 @cakes = @repository.search_with(params).
9 distinct.
10 includes([:photos]).
11 page(page).per(per_page)
12 end
13
14 def show
15 @creation = Creation.find(params[:id])
16 @primary_image = params[:photo_id].present? ? @creation.photos.find(params[:photo_id]) : @creation.primary_image
17 end
18end