RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Rails 4: My First Run-in with Turbolinks

Stafford Brooke writes about his first run in with turbolinks in Rails 4.

Comments

Although the author’s solution does solve the problem, a cleaner approach would be something like:

jQuery -> $(document).on "click", "span.star", -> ... code dealing with ratings ...

This has the 2 added benefits. Firstly, it doesn’t require you to nest all your handlers into a function that then needs to be called both on document ready and page:load. Secondly, you now only have 1 callback function created for the life of the session that handles the span.star click event.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in