0

I have an app where I need constantly change code, styles and javascripts. It is for administrator use. So it would be more easy to leave it in production as in development mode - without compiling assets, restarting server on update...

Also, I need all code and assets would be loaded freshly on every page load. Without compiling on update.

Problem. Even If I copy all configuration from /config/environments/development.rb to /config/environments/production.rb - On production Rails still searches compiled assets in /tmp/ dir. How to make it behave with assets as it does on development?

server: nginx
rails version: 4.0
Gediminas Šukys
  • 7,101
  • 7
  • 46
  • 59
  • setting assets.compile = true in environments/production should be enough, removing this file from precompilation may be also an option, here -> http://stackoverflow.com/questions/18935784/disable-assets-precompile-function-in-rails – mswiszcz Feb 18 '17 at 19:13

1 Answers1

0

It think you need to include development gems in production, as the process of loading assets, code, etc. in background is not taken by rails core but by specific gems, please see https://github.com/rails/spring for rails 5

in my gemfile i have:

group :development do
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'

end

eldi
  • 1,239
  • 11
  • 19
  • hmz now I can't check this method on Rails5, because current app is in Rails4 :) But thanks anyway looking to a future :) – Gediminas Šukys Feb 18 '17 at 09:51
  • I use spring for my other Rails 4.1.6 project as well. Check your Gemfile to see what you are using for "speed up development". If it's bundled with default gems, on creating rails app, then it should be commented appropriately:-) – eldi Feb 18 '17 at 13:18
  • spring actually has nothing to do with assets, it only preloads your ruby code in a separate process so your other tasks like rspec/rake are being run immediately inside that process, without the need to load everything when starting – mswiszcz Feb 18 '17 at 19:10
  • In question is stated that "I need all code and assets would be loaded...", otherwise if only assets need to be reloaded then `config.assets.compile = true` should do the job (http://guides.rubyonrails.org/asset_pipeline.html#live-compilation) – eldi Feb 18 '17 at 20:14