Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get started #51

Closed
seifsallam opened this issue Oct 14, 2013 · 15 comments
Closed

Can't get started #51

seifsallam opened this issue Oct 14, 2013 · 15 comments

Comments

@seifsallam
Copy link

I can't get api_taster to run. I can only see Warning Missing Definitions Detected

I didn't define any routes at first, and only added

App::Application.routes.draw do
  mount ApiTaster::Engine => "/api_taster" if Rails.env.development?
end

then I defined routes

App::Application.routes.draw do
  mount ApiTaster::Engine => "/api_taster" if Rails.env.development?

  if Rails.env.development?
    ApiTaster.routes do
      desc 'Get a __list__ of users'
      get '/users'
    end
  end
end

Still both cases it doesn't work, so i tried outside routes.rb

App::Application.routes.draw do
  mount ApiTaster::Engine => "/api_taster" if Rails.env.development?
end

if Rails.env.development?
    ApiTaster.routes do
      desc 'Get a __list__ of users'
      get '/users'
    end
end

Is there anything i'm missing? I'm using rails 4 btw. Also i'm using api-versions

@seandong
Copy link

seandong commented Nov 4, 2013

I have the same issue.

@brianlucas
Copy link

Same issue. I've copied the entire blocks of missing definitions and am not seeing any of them as actual API routes. Rails 4.01

@fredwu
Copy link
Owner

fredwu commented Nov 11, 2013

Hmm, I'm not using it in our rails 4 app so I can't be sure what's going on. Anybody wanna take a look and see if it's easily fixable? :)

@brianlucas
Copy link

It looks like @jtomaszewski is able to get it working on his Rails app. #49

Might be good to see if there is anything that needed to be added in an initializer or in Rails routes/config.

@brianlucas
Copy link

@fredwu, what starting point can I look at in the lib/engine to see why it is not picking up our Rails 4 routes which are defined exactly per README?

@damnitjim
Copy link

So what worked for me was to set the following value in an initializer

ApiTaster.route_path = Rails.root.to_s + "/config/api_doc"

then in that directory I created a routes.rb file with the API definition files per the instructions. I suspect a "routes" method was added in rails4 that is causing the issue. I'll dig into it when I get some free time and submit a pull request with a fix.

@RobWu
Copy link

RobWu commented Jan 9, 2014

Same issue for my rails 3.2.16 app using api_taster (0.7.0)

@RobWu
Copy link

RobWu commented Jan 9, 2014

Looks like it works fine with api_taster (0.6.0)

@tispratik
Copy link

I have the same issue on Rails 3.2

@tispratik
Copy link

It worked for me on Rails 3.2 with the following ref:

gem 'api_taster', '0.6.0', git: 'https://github.com/fredwu/api_taster.git', ref: '31c6f51'

@RobWu
Copy link

RobWu commented Mar 11, 2014

Connected to #45?

@mariochavez
Copy link
Collaborator

Yes is related to #45, code was already merged and new gem will be pushed to ruby gems soon.

@andyw8
Copy link

andyw8 commented Jun 13, 2014

I'm having this same issue with a new Rails 4.1 app, even with my Gemfile pointed to the master branch.

@mariochavez
Copy link
Collaborator

@andyw8 try to use latest api_taster gem version - that is what I'm using in my projects - also please review latest changes on README.

In your routes.rb file you should only mount api_taster engine:

Rails.application.routes.draw do
  mount ApiTaster::Engine => "/api_taster" if Rails.env.development?
end

Then create a file app/api_tasters/routes.rb this is the place where you should define your API routes for api_taster.

Finally add an initializer like this:

if defined? ApiTaster
  ApiTaster.route_path = File.join Rails.root, 'app', 'api_taster
end

@andyw8
Copy link

andyw8 commented Jun 15, 2014

Thanks for your help. I'm using 0.8.2, the latest release.

I have the api taster routes file in the default location so there so should be no need for an initializer (I tried just in case but it made no difference).

You say in my routes file I should mount only ApiTaster::Engine but I don't see any mention of this in the README. Where are my other routes supposed to go?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants