Reputation: 19
When I create an API service for my rails app I get a problem. The API is below:
module API
class Level < Grape::API
resources :levels do
get do
Level.all
end
end
end
end
and I also created a model named level
class Level < ActiveRecord::Base
some methods
end
when I request the API interface
undefined method `all' for API::Level:Class
so what should I do, I change the Level.all
to ::Level.all
it worked,but it's not good for me.
Upvotes: 0
Views: 510