There was a thread recently that brought up the idea of
modifying
javascript_include_tag to load a controller-specific js file
automatically. I took a look at doing that last night, and
discovered that it's actually quite a simple thing to do
without
extending the Rails source. In a layout, all you have to do
is:
<%= javascript_include_tag params[:controller] if
File.exists?("#
/public/javascripts/#{params[:controller]}.js&qu
ot;) %>
Admittedly, this is not DRY because you would need to do
this for
every application you write. But it is DRY for the current
application.
Just thought I'd pass that along.
Peace,
Phillip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
|