i have a template url called /monsters. and in the template, i have a sidebar
Sort by Type:
- Water
- Fire
- Earth
- Flying
- etc…
i was wondering what was the best way to route each of those? im guessing it would be good to have the urls such as
www.example.com/monsters/water
or
www.example.com/monsters/fire.
how should i go about doing that? on my routes.rb i thought of
match 'monsters/water', to: 'monsters#water'
match 'monsters/fire', to: 'monsters#fire'
match 'monsters/earth', to: 'monsters#earth'
match 'monsters/flying', to: 'monsters#flying'
etc…
but i feel like thats not a good way of doing. having a separate match going to a different action every time? could someone help me with the design? thorough and clear help would be much appreciated = )
thanks a bunch = )
or should i even be having separate links to begin with? should i be posting everything to my index action? i thought of using a form and using :post but thats already taken by my create action for monsters. currently on my index page (/monsters) its listing all of them because in my index action, i just do a
@monsters = Monster.paginate(page: params[:page])
What you need is:
This will generate these routes:
And it will allow you to do things like:
Plus, you can still use named paths:
And link to monsters like: