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

  1. create new link_to_not_registered helper use on every link_to , check if user logged in or not

  2. create before_filter check if user logged in. bit problematic, don't know how create filter when linking , not when directly accessing page

  3. 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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -