bploetz / versionist

A plugin for versioning Rails based RESTful APIs.
MIT License
972 stars 51 forks source link

Named routes error in rails 4 #46

Closed elfassy closed 10 years ago

elfassy commented 11 years ago

It also doesn't support :as option. (Rails 4, Ruby 2)

You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here:
bploetz commented 11 years ago

Need more info here. Can you provide the config/routes.rb snippet causing this, and the entire stack trace of the error that gets thrown?

Altonymous commented 11 years ago

I get the same error, it happens when one of my api_version calls has the default: true flag set.

api_version(module: "v1", header: { name: "Accept", value: "application/vnd.example.com; version=1" }, default: true) do
  resources :profiles
end
Altonymous commented 11 years ago

This appears to happen when you set one of your options as "header"...

When I set... it to path & default it works fine. it to header, path, & default it breaks. it to header & default it breaks.

bploetz commented 11 years ago

@Altonymous Thanks for this. I still need more info to reproduce this locally (which I have been unable to do). Can you send along:

Thanks.

Altonymous commented 11 years ago

These are the details you've asked for. the only change to produce the error is to point to the latest version of versionist instead of my repo.

https://gist.github.com/Altonymous/4173714adff004e8fb2f

Command: rails s

bploetz commented 11 years ago

@Altonymous What version of Ruby are you using?

Altonymous commented 11 years ago

2.0.0

bploetz commented 11 years ago

I've copied this configuration verbatim locally, and still cannot reproduce this error. Can you send the full stack trace of the error?

Altonymous commented 11 years ago

Did you change it so it wasn't pointing to my repo?

bploetz commented 11 years ago

Yes I was pointed at the latest released version of versionist. Can you please send the whole stack trace of the error?

bploetz commented 10 years ago

versionist 1.3.0 has been pushed to rubygems.org with this fix.