Closed starkovv closed 10 years ago
Thanks for reporting this @starkovv. Looking into it......
Oh.....duh. This isn't a bug in versionist. This is a bug in your routes. If you take versionist out of the picture and just have your resources
line in config/routes.rb
you'll get the same error:
config/routes.rb:
Rails.application.routes.draw do
resources :feedbacks, only: [:post]
end
> bundle exec rake routes
You don't have any routes defined!
Please add some routes in config/routes.rb.
For more information about routes, see the Rails guide: http://guides.rubyonrails.org/routing.html.
This is because the symbols passed in the :only
option must match the action method names that map to the CRUD verbs:
http://guides.rubyonrails.org/routing.html#crud-verbs-and-actions
So what you want is this instead:
resources :feedbacks, only: [:create]
When you fix this and add versionist back to the mix, you'll see it works correctly:
config/routes.rb:
Rails.application.routes.draw do
api_version(module: 'V1', header: { name: 'Accept', value: 'application/hasl+json; version=1', default: true }) do
resources :feedbacks, only: [:create]
end
end
> bundle exec rake routes
parent_resource.actions: [:create]
Prefix Verb URI Pattern Controller#Action
feedbacks POST /feedbacks(.:format) v1/feedbacks#create
My fault. Thanks @bploetz !
rails 4.1.0
orrails 4.1.5
+versionist 1.3.0
./config/routes.rb
:Console: