Ruby on Rails Tuesday, October 31, 2017

You can try something like this if the requirements match:

  match "/*path", to: redirect { |params, request|
    # Add your logic here or delegate the work to a specific class

    # Proof of concept
    slug = 'jazz' # You get the slug from the params
    price_category = true # You deduce if the slug matches any of your tags
 
    if price_category
      "/#{slug}?price=cheap"
    else
      slug
    end

  }, via: :all

--
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/CAL37D8F36mDnbzEHfW4P4_9aLaKP12PJLJRkC3nNn__t%3DHu8XA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment