Ruby on Rails Sunday, October 15, 2017

OK, so I have a homepage and want the user to be able to select a link that goes back to it with a varable set.  Example here is the listings site lists all events regardless of price and I want users to be able to list events under £5.  So I have a link https://eventpuddle.com?price=cheap.  This is fine but for SEO reasons I want to have the URL something like https://eventpuddle.com/cheapevents.  Obviesly I could create another view but there are all sorts of things I will ultimatly want ot do this for.  https://eventpuddle.com/jazz, https://eventpuddle.com/pucn, https://eventpuddle.com/art...  i would end up with LOTS of views and have to do code changes for eatch (see below).

I came across something years ago (I think in PHP)  where URLs got unpacked into varables in the background.  So https://eventpuddle.com/price/cheapevents was mapped in the background and created a varable price with a value cheapevents.

This will also be usefull for listing events for a certain venue, whitch I have lots.  Dont want to create a view for eatch venue as there are lots and I dont want to have to code stuff if I add venues, I simply add a row in the database for the new venue.  The kind of URLs I would be looking for is https://eventpuddle.com/venue/old-market-assembly or https://eventpuddle.com/venue/canteen.

Wondering if there is a way of doing this in rails or another way of handeling the same type of thing.


 

--
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/797df844-344c-4445-904e-1732687a4199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment