Ruby on Rails Thursday, February 22, 2018

Here's the bottom of one of my routes.rb files:

# this has to be the last option in order to work with unprefixed routes
get '/:slug', to: 'pages#show', constraints: lambda { |request| Page.pages.include? request.path_parameters[:slug] }

get "*any", via: :all, to: "errors#not_found"

That's not exactly what you asked for, but it's fairly close.

Walter

> On Feb 22, 2018, at 6:21 PM, Ralph Shnelvar <ralphs@dos32.com> wrote:
>
> What would routes.rb look like if I want EVERYTHING to go to a controller action called, hmm, 'everything' in static_pages.rb?
>
> Ralph Shnelvar
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1746028995.20180222162144%40dos32.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/13291EF3-5549-4BFC-B2AD-AEA75E58E1B5%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment