Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby on Rails Guides (v4.2.5) - Incorrect information in 'Working with JavaScript in Rails' section #22568

Closed
atul-shimpi opened this issue Dec 12, 2015 · 0 comments

Comments

@atul-shimpi
Copy link
Contributor

Information about how to call coffee script functions from event handler is not working as told in the guide.

2 Unobtrusive JavaScript

paintIt = (element, backgroundColor, textColor) ->
element.style.backgroundColor = backgroundColor
if textColor?
element.style.color = textColor

And then on our page:

Paint it red

painit is not getting called.
paintit needs to be delcared as @PaintIt
After that its getting called.
My rails ver - 4.2.3

prathamesh-sonpatki added a commit to prathamesh-sonpatki/rails that referenced this issue Dec 13, 2015
- Changed "paintIt" to "@PaintIt" so that it can be called in an on
  click handler.
- Closes rails#22568
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant