Reputation: 5411
I have a view with the following namespace
view/kids/registration/new.html.haml
Now I need to create a js file to this view, so I created a file in the following path:
assets/javascripts/kids/registration/new.js
Then I add the following lines to the application.js:
//= require ./kids/registrations/new
But it does not work. What I'm doing wrong. I'm checking the DOM (localhost:3000/kids/sign_up) but I never find line with this javascript file.
Thanks in advance for your help.
Adding the route
new_kid_registration GET /kids/sign_up(.:format) frontend/registrations#new
What I'm doing wrong.
Thanks.
Upvotes: 0
Views: 54
Reputation: 1403
I had faced similar problems while adding stylesheets to assets (Link to my question)
Here are few things you might wanna try:
As suggested by BOB add the require statements to application.js
I remember adding the list of files to application.rb
as:
config.assets.precompile += ['jquery.colorbox.js','colorbox.css', 'reportng.css', 'reportng.js']
<%= javascript_include_tag "your_js_file_name" %>
in your view fileUpvotes: 0
Reputation: 2121
Try //= require kids/registrations/new
or //= require kids/registrations/new.js
Upvotes: 1