Re: [Rails] Turning URL varables into URLs

2018-01-24 Thread kopf1988
I don't know why you're still trying /cheapevents when you haven't defined it at all. Not best practices really, but try something like: get 'events/:cost', to: 'upcoming_events#index' and then in your controller, respond based on things like: if params[:cost] == "cheap" @events =

Re: [Rails] Turning URL varables into URLs

2017-10-31 Thread Mugurel Chirica
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

Re: [Rails] Turning URL varables into URLs

2017-10-16 Thread Aboobacker M K
You can use something like this get 'venue/:name:', to: 'venues#show' class VenueController def show # render the view by checking params[:name] end end Check the above linked routing guide for more details On Mon, Oct 16, 2017 at 12:58 AM, Hassan Schroeder <

Re: [Rails] Turning URL varables into URLs

2017-10-15 Thread Hassan Schroeder
On Sun, Oct 15, 2017 at 10:49 AM, Ben Edwards wrote: > Great, thanks, almost there. Mine is slightly different as its not based on > CRUD, its a ruby view based on a SQL view. Irrelevant. You can use any parameter and controller method names you choose. -- Hassan

Re: [Rails] Turning URL varables into URLs

2017-10-15 Thread Ben Edwards
Aslo *http://localhost:3000/upcoming_events/cost* works but not *http://localhost:3000/upcoming_events/cost/cheapevents*. On Sunday, October 15, 2017 at 6:50:08 PM UTC+1, Ben Edwards wrote: > > PS I also tried > > get 'upcoming_events/cost', to: 'upcoming_events#index' > > > On Sunday, October

Re: [Rails] Turning URL varables into URLs

2017-10-15 Thread Ben Edwards
PS I also tried get 'upcoming_events/cost', to: 'upcoming_events#index' On Sunday, October 15, 2017 at 6:49:10 PM UTC+1, Ben Edwards wrote: > > Great, thanks, almost there. Mine is slightly different as its not based > on CRUD, its a ruby view based on a SQL view. So > > get

Re: [Rails] Turning URL varables into URLs

2017-10-15 Thread Ben Edwards
Great, thanks, almost there. Mine is slightly different as its not based on CRUD, its a ruby view based on a SQL view. So get '/patients/:id', to: 'patients#show' Is not quite what I need. If I have this view as root view (http://domain.tld) and want to pass cost as a variable

Re: [Rails] Turning URL varables into URLs

2017-10-15 Thread Hassan Schroeder
On Sun, Oct 15, 2017 at 6:39 AM, Ben Edwards wrote: > 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

[Rails] Turning URL varables into URLs

2017-10-15 Thread Ben Edwards
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.