Skip to content

Instantly share code, notes, and snippets.

@hisapy
Last active December 15, 2015 06:29
Show Gist options
  • Save hisapy/5217163 to your computer and use it in GitHub Desktop.
Save hisapy/5217163 to your computer and use it in GitHub Desktop.
Template is missing Missing partial candidatos/thumbnails with {:locale=>[:es], :formats=>[:json], :handlers=>[:erb, :builder]}. Searched in: * "/Users/hisa/Documents/workspace/elecciones2013/app/views" * "/Users/hisa/.rvm/gems/ruby-1.9.3-p327@elecciones2013/gems/dynamic_sitemaps-1.0.8/app/views" * "/Users/hisa/.rvm/gems/ruby-1.9.3-p327@eleccion…
# This is inside application helper and it works well when request using HTML format
def thumbnails_tag objs
#Uncomment the line below to test when no much data available
# @listas.fill(@listas.first, 0..6)
thumb_span = 4
case @candidatos.length
when 1..3
thumb_span = 12 / @candidatos.length
else
thumb_span = 4
end
thumbs = {span: thumb_span}
render partial: 'candidatos/thumbnails', locals: {candidatos: @candidatos, thumbnail_options: thumbs }
end
# here is the index action of CandidatosController
def index
@candidatos = Candidatos::Base.paginate(page: params[:page], per_page: 3).to_a
respond_to do |format|
format.html # index.html.erb
format.json { render json: view_context.thumbnails_tag(@candidatos) }
# format.json { render json: @candidatos }
end
end
# And just to let you know my index.html, the one displayed when requesting HTML is
<div class="row-fluid">
<%= thumbnails_tag @candidatos %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment