javascript - render :layout => 'application' conflicts with kaminari -
i trying make kaminari ajax button work, have 1 problem seems causing error , stopping kaminari work.
index.controller.rb
def index @works = work.page params[:page].per(10) respond_to |format| format.html format.js end render :layout => 'application' end
and returns me error...
undefined method `each' nil:nilclass
below have in view file. root.html.slim
= render "layouts/alert" .mainwrapper.cf #workwrapper.cf #intro h1 | foriio platform creators. br | aim bring portfolio creators. p | think, shouldn’t matter whether can code or not. br | nor whether know how use photoshop. br | aim make things lot easier creators make portfolio. #howto ul li.one-third.column = image_tag "step1.png" | 1. sign in facebook account li.one-third.column = image_tag "step2.png" | 2. submit work, , portfolio ready! li.one-third.column = image_tag "step3.png" | 3. tag collaborators such stylists, make artists, etc. br | or tag if involved! h2.recenttitle recent uploads ul#works = render :partial => "works"
this view file _works.html.slim
- @works.each | work | = link_to work li.works span.thumb = work_image_of work h4 = link_to work.title, work, thumb:true p.pull-left small = work.collaborators.count.to_s | collaborators p.pull-right small = link_to 'edit', edit_work_path(work) if can? :update, work | = link_to 'destroy', work, data: {:confirm => 'are sure?'}, :method => :delete if can? :delete, work = paginate @works, remote: true
i guessing 2 @works... , render :layout =>application.... can not co-exist??
how fix this??? thank in advance!
note: render :layout => 'application' loads header , rest of page.
my trace log
processing indexcontroller#root html rendered layouts/_alert.html.slim (0.4ms) rendered index/_works.html.slim (9.9ms) rendered index/root.html.slim (22.9ms) completed 500 internal server error in 32ms nomethoderror - undefined method `each' nil:nilclass: app/views/index/_works.html.slim:1:in `_app_views_index__works_html_slim___3157568365315559456_70136848436740' actionview (4.1.5) lib/action_view/template.rb:145:in `block in render'
Comments
Post a Comment