Facebook(er) and Authentication Filters

I am looking at this app:

When in facebook, it knows to force the user to add the app when a link
which requires it is appropriate, yet when viewing from
www.mobtropolis.com, it knows to send the visitor to
http://www.mobtropolis.com/account/login.

How does this app do it?!
How are the filters setup?! Where do they go?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs