[Solved] ElegantRails – Multiple Routes to one Controller Action
Absolutely there is. You can use a parameter directly in your route. Even further, you can then use that parameter directly in your query, rather than using a case statement. #routes.rb get ‘suggestions/:type’, to: ‘suggestions#index’ # suggestions_controller.rb def index @suggestions = Suggestion.where(suggestion_type: params[:type]) end It’s always a better practice to base your controller actions after … Read more