ruby - Rails: Send request back to router -


i working on app cms-functionality client can match arbitrary paths articles.

now, use route globbing match html request , check in controller if have article show. if no article present, want send request route resolution flow, search other potential matches.

i imagine there should exception that, can't figure out. it's not routingerror.

the configuration file: config/routes.rb runs top-to-bottom when defining application routes. need define catch-all @ top of file.

i'd recommend using sort of constraint (so can cache result). example, solution may like:

 # config/routes.rb  '*', to: 'article#show', constraints: articleconstraint.new   # lib/article_constraint.rb  class articleconstraint    def matches?      # trivial example... make better, e.g. use cacheing!      article.exists?(name: request.path)    end  end 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -