I've been having trouble using the Asset Pipeline. Although I read an excellent guide here I still have trouble.
I'm trying a javascript solution for adding form elements "on the fly" from this [guide] (http://ift.tt/1TwXHxb)
When I put the javascript into a <script>
tag at the bottom of my page, everything works as expected. If I simply copy and paste the script into application.js the code also works. However, when I try to move the code to app/assets/javascripts/people.js
my site throws a Reference Error.
This is a similar problem to the questions on SO titled 'Ruby on Rails 3.1 RC1 Javascript Asset Pipeline Problem' (not enough rep for the link), but I only have one script, so the alphabetical solution doesn't help. Moving the file to vendor/assets/javascript also didn't help.
Application.js currently looks like:
This is a manifest file that'll be compiled into application.js, which will include all the files
listed below.
Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
compiled file.
Read Sprockets README (http://ift.tt/1Hr2XzQ) for details
about supported directives.
= require people.js
= require_tree .
Aucun commentaire:
Enregistrer un commentaire