0

I have my own personal website which I wish to temporarily close. On my local dev version in my PagesController which handles my static pages I have created a closed action which shows a nice message to my users.

I want to deploy this but how can I change the root route to that action without doing it locally, committing, deploying and removing it locally again.

I want to be able to route to the closed action now and again nice and quickly.

Neil

rctneil
  • 7,016
  • 10
  • 40
  • 83

1 Answers1

1

You can set up a before filter.

Check this answer out for a similar situation: Rails: admin-only maintenance mode

Community
  • 1
  • 1
Eric
  • 3,142
  • 17
  • 14
  • ok, so if I was using the first example shown on there, where do I set the ENV['ADMIN_MODE'] variable and how do I quickly alter that without doing a full deploy? – rctneil Oct 10 '12 at 21:08
  • ENV['ADMIN_MODE'] will check the environment, so you could do this by just restarting your servers with an ADMIN_MODE environment variable set (e.g. "env ADMIN_MODE=1 rails s"). If you don't want to do this, you could do something like pull that from a database, but that's going to add an extra db call to every request and require that you keep your db running during maintenance mode. – Eric Oct 10 '12 at 21:13