简体   繁体   中英

Cannot edit a javascript asset in rails

I am trying to change the functionality of the autocomplete-rail.js file once I've done the

rails generate autocomplete:uncompressed

to get the full jquery code

however, every change that I make (in comments or in code) doesn't seem to matter

I've saved the file, restarted rails s, deleted cache.. nothing works.

the file is currently in public/assets (where the generator puts it)

I can see from the source that /assets/autocomplete-rails.js?body=1 is being served..

going to it does not give me jquery.. but regular javascript

what is going on?

update

I searched for the file and if I edit the file in

C:\Ruby193\lib\ruby\gems\1.9.1\gems\rails3-jquery-autocomplete-1.0.6\lib\assets\javascripts

I can see that that is the file being served.. (I edited it and I see it being served with the edit)

this is a problem in working on different computers on the same repo since the edits to this file are kept in the gems directory and not in the app's..

is there a way to solve this?

If the file exists in public/assets , then that's the file that the web server will serve. I suggest you delete that entire directory so that Rails will dynamically serve your assets.

解决了。​​我只是将该文件直接复制到资产目录。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM