2

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" in
views/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] &quot;/javascripts/groups.js&quot;</pre></p>



</body>
</html>

and I also tried putting //= require_tree . in
app/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+

6
  • 1
    Add =javascript_include_tag "application" and check by restarting the server if it works for you Commented Oct 21, 2013 at 20:12
  • Thank you, I tried that and still got the Action Controller: Exception caught error Commented Oct 21, 2013 at 20:14
  • 1
    Then guess the coffeescript file is not being compiled afterall. Why don't you create a simple group.js file in app/assets/javascripts with anything (say alert("FOO")) and then check if that file is available. Commented Oct 21, 2013 at 20:16
  • Upgraded to rails 2.3.8 didn't help though. the groups.js file is very simple (only 5 lines long). Commented Oct 21, 2013 at 20:26
  • Can we discuss this at : chat.stackoverflow.com/rooms/5676/ruby-on-rails ? Commented Oct 21, 2013 at 20:28

1 Answer 1

4

You might want to make sure that:

config.assets.enabled = true

is present in application.rb.

Also, the following link might be helpful: http://pivotallabs.com/giving-rails-2-the-asset-pipeline!

Sign up to request clarification or add additional context in comments.

15 Comments

This app was originally developed in rails 2.3.8 so I put there is some setting that I need to change that would be pre-set on a new app
@MichaelDurrant ahh gotcha. Would you maybe be willing to post the dev env config?
@MichaelDurrant also, which version of rails are you using now?
rails 3.1.8 and I think that is the problem. I've changed it to rails 3.2.8 and trying that
Is config.assets.enabled = true present in application.rb under the config directory?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.