I have the following coffeescript file that I wish to include:
app/assets/javascripts/groups.js.coffee
I have an application file - app/assets/javascripts/application.js
that has:
//= require_tree .
My views/layouts/application.html.haml
file includes:
= javascript_include_tag :defaults = javascript_include_tag "jquery-ui-1.8.22.custom.min.js"
My page does not seem to have the groups.js
file
It does get the jquery-ui-1.8.22.custom.min.js
but I'm not sure where from.
I tried putting = javascript_include_tag "groups.js"
inviews/layouts/application.html.haml
and restarted the server and that does then have a groups.js
referenced in the header but clicking on that actual file (in the browser show view) shows this:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Action Controller: Exception caught</title> <style> body { background-color: #fff; color: #333; } body, p, ol, ul, td { font-family: helvetica, verdana, arial, sans-serif; font-size: 13px; line-height: 18px; } pre { background-color: #eee; padding: 10px; font-size: 11px; } a { color: #000; } a:visited { color: #666; } a:hover { color: #fff; background-color:#000; } </style> </head> <body> <h1>Routing Error</h1> <p><pre>No route matches [GET] "/javascripts/groups.js"</pre></p> </body> </html>
and I also tried putting //= require_tree .
inapp/assets/javascript/application.js
but just got an error messages that the file wasn't found (javascript/groups.js
)
I also tried rake assets:precompile
but that gives a strange error about Please install the pg adapter: gem install activerecord-pg-adapter
but trying that gives ERROR: Could not find a valid gem activerecord-pg-adapter (>= 0) in any repository
I have no idea what that is about as the application is working full both locally and on remote, using the database with no problem, so it's probably a separate issue. I mention it in case you suggest rake assets:precompile
is needed, however to have the assets used in development this should not be an issue (I think).
Originally the app was rails 2.3.8 but now it 3.1.8 - hmm, this be may key if assets came in 3.2+
=javascript_include_tag "application"
and check by restarting the server if it works for youAction Controller: Exception caught
errorgroup.js
file inapp/assets/javascripts
with anything (sayalert("FOO")
) and then check if that file is available.