Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Rake routes: parses default route twice #20

Closed
dtsiknis opened this Issue · 4 comments

2 participants

@dtsiknis

Trying to use versionist with url prefix method. I have version 1 of the api set to be the default. It works fine in regular execution but when I run rake routes it parses the routes twice, and gives me the following error:

[VERSIONIST] attempt to set more than one default api version

My routes config looks (something) like this:

api_version(:module => "V1", :path => "/v1", :default => true) do
resources :merchants do
resources :products
end
end

Rails version: 3.0.6
Ruby version: 1.9.2-p290
Versionist version: 0.2.1

It seems that either the clear method should be called or the routes shouldn't be parsed twice. It seems the first time is during the "Execute environment" phase and the second is during "Execute routes"

@bploetz
Owner

This works in Rails 3.1 and 3.2, but breaks as you describe in Rails 3.0.

Rails 3.2:

[bploetz:~/tmp/test-api-rails32]> bundle exec rake routes
_v1_test GET /v1/test(.:format) api/V1/test#test {:format=>"json"}
         GET /test(.:format)    api/V1/test#test {:format=>"json"}

Rails 3.1:

[bploetz:~/tmp/test-api-rails31]> bundle exec rake routes
_v1_test GET /v1/test(.:format) {:format=>"json", :controller=>"api/V1/test", :action=>"test"}
         GET /test(.:format)    {:format=>"json", :controller=>"api/V1/test", :action=>"test"}

Rails 3.0:

[bploetz:~/tmp/test-api-rails30]> bundle exec rake routes
rake aborted!
[VERSIONIST] attempt to set more than one default api version

Tasks: TOP => routes
(See full trace by running task with --trace)

Routes reloading has popped up in two other issues (#4 and #3) so this might be related. Will take a look.......

@bploetz
Owner

This is fixed in versionist 0.2.2. Can you update your Gemfile to depend on this new version and confirm that it fixes the issue for you?

@bploetz bploetz closed this
@dtsiknis
@bploetz
Owner

Cool. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.