RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: ipranay
Did you find a solution to this?.. I am getting a similar error!
Well, you could add :dependent => :destroy to each has_many association. and then simply delete your Survey!
:dependent => :destroy
I encountered this too!.. any solutions so far?
Sweet.. I was looking for this... Thanks!
Thanks.. I ran into this as well!
Thanks for this ryan, amazing as always!
I used this with Kaminari along with using a script to see if the pagination links are in the window view area (since I was working with a table that is in the middle of the page)
Coffee Script below:
isScrolledIntoView = (elem) ->
docViewTop = $(window).scrollTop()
docViewBottom = docViewTop + $(window).height()
elemTop = $(elem).offset().top
elemBottom = elemTop + $(elem).height()
(elemTop >= docViewTop) && (elemTop <= docViewBottom)
url = $('.pagination .next_page a').attr('href')
if url && isScrolledIntoView('.pagination')
And in the index.js.erb file:
$('#all_pages').append('<%= j render(@pages) %>');
<% if (@pages.current_page < @pages.num_pages) %>
$('.pagination').replaceWith('<%= j paginate(@pages) %>');
<% else %>
<% end %>
I used @pages.current_page < @pages.num_pages since I couldn't get the @pages.next? method working with collections. Hopefully it will work in a future release.
@pages.current_page < @pages.num_pages