Add a default route to your routes.rb
. At the very end just do a
match ":default" => "foo#default"
And inside foo_controller.rb
def default
# here are your params
parts = params[:default].split("-")
controller = parts[0]
action = parts[1]
genre = parts[2]
records = Movie.where(genre: genre)
if records.count > 0
# redirect to your controller aciton
else
raise ActionController::RoutingError.new('Not Found')
end
end
It's not tested, but I think you should get the point.