I have a Rails application setup where, after all of the other site routes are defined, I have a catch-all wildcard for my Users to display their Profiles on selected root-level "vanity" URLs of non-reserved paths/keywords:
get '*path' => 'profiles#show'
The Profiles controller then checks to make sure the path defines a valid Profile, otherwise redirects to root. This works fine.
What I need to do now is create a mechanism where the catch-all path could define either a Profile or a Blog, based on the database lookup of the path for the proper controller to route to.
I do not want to do a redirect ... I want to load either the Profile or Blog content on the original wildcard URL.
What are my options to go from wildcard route -> db lookup -> proper controller?
In other words, where might this logic properly go?
Thanks.