Bash Environment Variables
I was getting a double render on my bounty form. This was because I had precompiled my assets in an attempt to rectify Gitbo’s server issue last week. Since
issue.js has been compiled into
application.js, it is listening twice.
StackOverflow had this to say and this solution
bundle exec RAILS_ENV=development rake rails_group=assets assets:clean.
bundle execwould be needed if the gem file and my system files were different. In Gitbo’s case, there is no discrepancy. On the server, that can’t be assumed and
bundle execwould be needed.
- The default environment for a rake task is development except for assets which obviously have more to do with production.
- Rake tasks are very flexible in terms of how they take bash environment variables (they are sort of like arguments, but they aren’t). Passing in the rails_environment before the rake task is how I did it, but they could be passed in afterwards and that would be fine because BASH reads the entire line of code before it executes it.
Here was the final command I used:
RAILS_ENV=development RAILS_GROUP=assets rake assets:clean
Show does have an instance variable. The view is attached to an instance of a controller
In a partial, this is just crazy…
- a view is not part of the controller, so why should it have access to an instance of a controller.