Closed ticktricktrack closed 12 years ago
Regarding the first error, can you include:
As for the second error when running the generator, the way the generator verifies that the API version is already present is that it looks for the module passed on the command line in an api_version()
method in config/routes.rb
, and if it doesn't find it you get the error above. Since you passed Api::V1
on the command line, but the api_version()
in your config/routes.rb
only has :module => "V1"
(missing the Api::
bit), it's erroring out. Versionist doesn't currently have the smarts to look for an API version across namespace/scope and api_version. Pull requests welcome. :-)
Having said that, does this get you what you're looking for? It works for me locally.
api_version(:module => "Api::V1", :header=>"Accept", :value=>"application/mycompany.com; version=1", :default => true, :defaults => {:format => :json}) do
scope :path => '/api' do
match 'test' => 'foos#test', via: :get
end
end
Just getting back to my API, no more delays, no more other more important features. I hate having to read me back in to my own reported issues instead of being able to fix them. I'm going to solve this now!
You were absolutely right, works fine now.
At the moment I have found 2 ways to define the routes, each giving me a different error: (version was generated with module Api::V2)
1) This one uses scope '/api/ and the full module "Api::V1", the generators work fine, but default version doesn't
returns:
whereas my other configuration option using namespace instead of scope does support default values, but the generators will fail: