Skip to content

Instantly share code, notes, and snippets.

@laspluviosillas
Last active December 14, 2015 13:48
Show Gist options
  • Save laspluviosillas/5095588 to your computer and use it in GitHub Desktop.
Save laspluviosillas/5095588 to your computer and use it in GitHub Desktop.
Routing error
I'm using the active_admin_associations gem to get this route, so the definition in routes.rb of the Gem is not that standard:
if Rails.application.config.aa_associations.autocomplete_models
models = Rails.application.config.aa_associations.autocomplete_models.join('|')
Rails.application.routes.draw do
match '/autocomplete/:model' => 'autocomplete#index', :model => /(#{models})/,
:defaults => { :format => 'json' }
end
end
This is activated with the following configuration option in config/application.rb
config.aa_associations.autocomplete_models = %w(ole_core_distributor ole_core_account)
Since this is in config, I, of course, restarted the server before trying to get to the URL.
This generates the following in rake routes:
/autocomplete/:model(.:format) autocomplete#index {:model=>/(ole_core_distributor)/, :format=>"json"}
And the routing error:
Started GET "/autocomplete/ole_core_distributor" for 127.0.0.1 at 2013-03-05 17:57:14 -0600
Processing by ApplicationController#routing_error as HTML
Parameters: {"path"=>"autocomplete/ole_core_distributor"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment