0

I have a JavaScript file called users.js and it is in app/assets/javascripts/users.js. I have it load in a single page using

<%= javascript_include_tag params[:controller] %>

I was thinking of using some Ruby code in the JavaScript file, so I changed the filename to users.js.erb. But when I do, the file shows up in my SublimeText project view as users.js.erb.js, and when I run my Rails app, I get a 404 error saying users.js.js couldn't be found.

Help? Thx.

1 Answer 1

1

From my perspective, this is not a rails problem, but a problem with the editor you use. Check the file information in finder with cmd-i and change it back to users.js.erb.

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

2 Comments

Oh, I didn't change the filename with the editor. I did it in the Finder. I just happened to see that's how SublimeText reported the name.
I did a little experiment independent of files/projects that were ever used or viewed in SublimeText and was still having the issue. For some reason, my Finder was adding the extra .js extension. When I change the file name via Cmd-i as you suggest, all is well.

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.