Reputation: 55
I'm hoping you can help.. I have inherited a small site in rails that I have been tasked to edit. I have a good understanding of PHP, but am a total newbie to rails.
I need to make a very simple edit to a file, which I have done, but it is not showing up on the site when I save. The file is located in the config directory. I have restarted the machine it is being served from (Mac OS 10.8), I have searched online for a number of answers including disabling caches, changing config.cache_classes to false and config.consider_all_requests_local to true, but nothing seems to work. The site is using unicorn as the server.
What am I missing? I realise this is probably a terrible way to work with rails, and I've promised myself I will learn it, but for now I just need to know how to make live changes as I am used to FTPing changes with html, php etc.
Thank you in anticipation!
Upvotes: 0
Views: 1293
Reputation: 55
Here's what I had to do in the end, and I realise this is not the way you are meant to work with Rails..
I backed up the app directory, re-imaged the dev machine I was using to test it. Performed a clean installation of Ruby on Rails as per http://rubyonrails.org/download. I created a new empty app with the same name, then copied the contents of the app I was working with to the new app skeleton choosing not to overwrite any existing files. Then I installed Passenger and ran it as a standalone. This got my app up and running again, and now when I made any changes to the file in config/initializers they were reflected when I restarted passenger. So I'm good to go.
Now I need to learn how to really do it.. Thanks all.
Upvotes: 0
Reputation: 14038
It is common to deploy Rails applications using software called Capistrano. If you find files app/Capfile
and app/config/deploy.rb
then your app is using it. The typical workflow with Capistrano is
git clone
from GitHub)cap deploy
to do all of the things that may be needed, e.g. recompiling asssetsWhat capistrano does (in the most basic usage) is:
your-app-name/releases/<date-filename>/
git pull
)your-app-name/current
with one to the new directorytouch your-app-name/current/tmp/restart.txt
does the trick, otherwise, you might need to restart the web serverAs noted in another answer, changes to "assets" (CSS, JS, images) will need to be recompiled. I think running bundle exec rake assets:precompile
from the <your-app-name>
subdirectory is all that is needed, but if things get messed up, run bundle exec rake assets:clean
first.
In some cases, capistrano and source control are set up to require that deployments use the local credentials of the user doing the deploy -- this is supported by ssh-agent
and the ssh-add
commands. You would need these if your source control system does not allow access from the server directly (you'll see a line ssh_options[:forward_agent] = true
in your app/config/deploy.rb
if this is how it's set up).
Of course there can be many other dependencies that need to be managed depending on your environment. If you have even a remotely advanced environment, you should do the work of figuring out how to deploy the right way, probably with capistrano.
Upvotes: 0
Reputation: 3568
probably just need to run touch tmp/restart.txt from the app root dir if you have ssh access
PROJECTDIR/tmp/restart.txt
you can open tmp/restart.txt on your FTP server via any text editor and press Ctrl+S (save it), so file will be touched and server will be restarted
or if you have ssh access run
touch tmp/restart.txt from your rails app root
---EDIT---
Sorry didn't see the part where you said you had restarted the machine. More likely an issue with assets pipeline.
Try deleting public/assets
and then running
bundle exec rake assets:precompile
I think there is a command to clear and recompile but I can't remember it
Also if these answers don't help it might be helpful to know what you have actually edited and how. Is it css? Markup? A controller?
Upvotes: 0
Reputation: 10090
If you have restarted the machine it is being served from and the changes still don't show up, then you were editing the wrong file alltogether. Maybe it's really served from another folder on this machine? Or from another machine?
Upvotes: 2