Answer the question
In order to leave comments, you need to log in
How to fix Error with routing or route helper in Rails?
Doing non-REST routing in a Rails application:
get "/:id" => "offers#show", as: :offer, constraints: { id: /\d/ }
get "/:region_slug" => "offers#index", as: :region_offers, constraints: { region_slug: /[a-z]/ }
get "/:region_slug/:id" => "offers#show", as: :region_offer, constraints: { region_slug: /[a-z]/, id: /\d/ }
get "/:region_slug/:scope_slug" => "offers#index", as: :region_scope_offers,
constraints: { region_slug: /[a-z]/, scope_slug: /[a-z]/ }
get "/:region_slug/:scope_slug/:id" => "offers#show", as: :region_scope_offer,
constraints: { region_slug: /[a-z]/, scope_slug: /[a-z]/, id: /\d/ }
= link_to category.name, region_scope_offers_path(@region.slug, category.slug)
ActionView::Template::Error (No route matches {:controller=>"offers", :action=>"index", :region_slug=>"region1", :scope_slug=>"category1", :format=>nil} missing required keys: [:region_slug, :scope_slug])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question