posts.js.coffee.erb
$('.list').infinitescroll {url: '<%= list_posts_path %>', triggerAt: 700, container: $('.container'), appendTo: $('.container'), page: 1}
This makes an exception:
throw Error(“NameError: undefined local variable or method
`list_posts_path’ for #<#:0x00000003557438>\n …
list_posts_path returns correct path if I use it in controller. What I do wrong?
Yeah, don’t do that. 🙂
You’re not inside a controller, even though you’re using ERB. The coffeescript compiler doesn’t know anything about your routes or routing helpers, which your views typically get access to through the controller.