Maybe you can add authenticate_user! in your ApplicationController
class ApplicationController < ActionController::Base
......................
before_filter :authenticate_user!
And skip the filter for the page you want guests to visit.
Вопрос
I'm trying to implement a feature where a user invites friend to the site, and the invited person will land on the page and view that page, but then when trying to view another page by clicking on a link, it asks them to sign up.
I was thinking about using Devise timeoutable and setting the session to 1.second for guest users. So it would be something like this:
class User < ActiveRecord::Base
devise (...), :timeoutable
def timeout_in
if self.guest?
1.second
end
end
end
Is this the correct way of handling this type of situation? Or is there a better way?
Нет правильного решения
Другие советы
Maybe you can add authenticate_user! in your ApplicationController
class ApplicationController < ActionController::Base
......................
before_filter :authenticate_user!
And skip the filter for the page you want guests to visit.