Rails, different routes for production app.

Posted by Joseph Silvashy on Stack Overflow See other posts from Stack Overflow or by Joseph Silvashy
Published on 2010-04-17T23:41:51Z Indexed on 2010/04/17 23:43 UTC
Read the original article Hit count: 231

Filed under:

Well, maybe not just different routes. Here is the issue at hand, we have an app that we want to present the users with a "beta sign-up" form when the app is running in production, but we still want to be able to login, however in development the app should function normally.

For example in development the app's root path would be the page that show's all the products (using a store as an example) but in production we want the app to present the user with a beta page that just has a form for leaving an email, but also be able to sign-in for users that have accounts.

We don't need any help with authentication, that's all sorted out more just the setup of redirecting users to the beta page in production so they can't explore the site unless they are logged in.

We are using Devise so I thought maybe we could put something in our application controller that's like:

before_filter :authenticate_user! if ENV['RAILS_ENV'] == 'production'

But that doesn't seem like it works.

© Stack Overflow or respective owner

Related posts about ruby-on-rails