views:

34

answers:

1

I have a Rails 3 App.

When the user is not signed in... I want devise to show non-signed in pages: SignIn, register, about us, blog etc...

When a user is signed in I want it to go to the web app

where do I make this switch and how do I set it up? thanks

+1  A: 

This is easy! I just finished a Rails 3 app with devise, so my pain can be your gain. Just include the before_filter at the beginning of the controllers you want to protect. Let's use the example of a Videos controller:

class VideosController < ApplicationController
  before_filter :authenticate_user!

  # all your actions go here: index, new, create, etc #
end

You can also pick and choose what actions in the controller are filtered:

class VideosController < ApplicationController
  before_filter :authenticate_user!, :only => [:edit, :update, :destroy]

  # all your actions go here: index, new, create, etc #
end

Devise gives you the authenticate_user! method, and redirects for you.

Jaime Bellmyer