Hi All!
Another problem. I am using Rails 5.0.0.beta3 with a minor javascript
file (115 lines). I have encountered the following problem several
times in the past two days. In both earlier cases, I ended up returning
to the master branch and starting over (there were very few changes in
those two branches, I hadn’t gotten very far). Now I have it very close
to being finished and I can’t seem to get it to work like it was a few
minutes ago. Unfortunately, I have not committed my changes frequently
enough (dumb, I know) so I will have to start over again. (I can copy
the edited files out of the git tree, create a new branch and copy them
back, but I would like to get to the bottom of this weirdness before I
do),
I am working in development mode. I can edit and test the .js.erb
file in assets with no problems for hours on end. Most of the time I
don’t even have to restart the server (usually when I edit routes.rb).
Suddenly, it gives me an error message about needing to pre-compile
the js file in production mode by editing a config file and
restarting. Without changing the config (as it recommends) when I
restart the app it no longer loads the javascript file, and none of the
routines in it execute anymore. It also ignores any edits that I make
to that file. In one of the earlier cases I did edit the config file as
it requested, but that did nothing to solve the problem.
I don’t have any idea what I might have changed to cause this. I looked
at the git status and I have only changed/created four files:
- The layout file that originally had the js code (was moved to the
newly created js.erb file) - The controller file
- The routes.rb file, and
- The newly created js.erb file.
The last edit was to correct a typo in the js.erb file.
The program works (loads the js from the layout file and does everything
that is already coded) when I switch back to the master branch, but as
soon as I go to the working branch, the problem comes back.
The rails log seems to show it loading pre-compiled scripts after it
breaks, while before it seems to be getting files from the assets
directory. (Not sure about this).
I tried both Firefox and Chrome and both show the same behavior (not
surprising).
I double checked that RAILS_ENV=development and it is. This has been
setup for years and only changes when I explicitly set it to production
(rarely). It returns to development whenever I login.
Where should I start looking for this problem?
Thanks,
Don