raludvigsen
raludvigsen

Reputation: 11

Using Devise, how can I set the root page to not redirect to the "sign_in" page if the user is logged out?

I would like to populate the root page with certain items from my database and just have a link to sign in somewhere on the page. Basically I don't want to make the content exclusive to those who are logged in.

Upvotes: 1

Views: 40

Answers (1)

Andrew K
Andrew K

Reputation: 1349

In your root controller, just add:

skip_before_filter :authenticate_user!

Example:

class RootController < ApplicationController
  skip_before_filter :authenticate_user!

  def index
    #some logic here
  end
end

You can also limit it to just the index action:

skip_before_filter :authenticate_user!, only: [:index]

Good luck!

Upvotes: 2

Related Questions