Want to avoid feeling like a chump and spending countless hours troubleshooting a crazily-stupid-simple problem?
When you enter a .js in your javascripts directory and include it using a javascript_include_tag, take the <script> tags off the front and back.
You probably knew that already. Why didn’t you tell me sooner?
>Want to avoid feeling like a chump and spending countless hours troubleshooting a crazily-stupid-simple problem?
Why, yes! Yes I do!
>When you enter a .js in your javascripts directory and include it using a javascriptincludetag, take the
Oh, okay.
>You probably knew that already. Why didn't you tell me sooner?
I didn't knowit already! You have to believe me!
December 14, 2007 at 5:27 pm
Here’s another tip:
the javascript_include_tag also allows you to include multiple scripts at once, separated by commas.
I’ve seen people use it over and over like this:
javascript_include_tag(“script1″)
javascript_include_tag(“script2″)
javascript_include_tag(“script3″)
Instead, you can just do this:
javascript_include_tag(“script1″, “script2″, “script3″)
you can also include :defaults which can be configured (but by default is Prototype/Scriptaculous) and you can include :all which will nab everything in the public/javascripts folder.
June 6, 2008 at 9:30 pm