Rails Deeplinking to inner pages of the app

What is deep linking?

App deep linking is a fancy way to refer to a URL that points to a specific part of an app. It’s analogous to a URL that points to a subfolder of a website. For example if I wanted to send you an article on Rails Developer Community, I would send you a URL that immediately brought you to the article, not send you to the shivabhusal.com main portal to navigate to it yourself from there.

 

By default this feature is supported by the gem `devise` out of the box

Just make sure the code before_filter :authenticate_user! is at the top of the controller

You can also modify behavior like

def after_sign_in_path_for(resource)
  if current_user.sign_in_count == 1 && current_user.has_role?(Role::RoleParent)
    # if its user's first signin since signup, the redirect to users first pact manage page
    introduction_pacts_creator_index_path
  else
    stored_location_for(resource) || request.referer || root_path
  end
end

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s