ruby on rails 3 - Accessing a url directly without login -
i considering doing -
any url (excecpt disallow specifically) can accessed directly without signing-in, if click on of links on page, redirect sign-up page
i thinking of several ways of doing it, neither flexible enough work devise
create new
link_to_not_registered
helper use on everylink_to
, check if user logged in or notcreate before_filter check if user logged in. bit problematic, don't know how create filter when linking , not when directly accessing page
have external flag test if user logged in , change page accordingly.
neither way helps me redirect user after sign-in/sign (new helper links sign up, before filter becomes complex, flags simple)
is there way create functionality of direct access show actions while clicking on links requires login?
i think best approach before_filter. can check previous page request.referrer, if it's page inside app, redirect user signin path
def to_signin redirect_to singin_path if request.referrer["http://myapp.com"] end
Comments
Post a Comment