-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Hi,
This happens when I try to start rails console. Any idea what might be wrong?
I'm running using grape (0.7.0) and grape-entity (0.4.3)
activesupport-4.1.1/lib/active_support/dependencies.rb:481:in
`load_missing_constant': Unable to autoload constant User, expected app/api/v1/user.rb to define it (LoadError)
from /.rvm/gems/ruby-2.1.2@A/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:180:in `const_missing'
from /.rvm/gems/ruby-2.1.2@A/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:512:in `load_missing_constant'
from /.rvm/gems/ruby-2.1.2@A/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:180:in `const_missing'
from /.rvm/gems/ruby-2.1.2@A/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:512:in `load_missing_constant'
from /.rvm/gems/ruby-2.1.2@A/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:180:in `const_missing'
from /Users/martins/Work/Project/app/api/api.rb:3:in `<class:API>'
app/api/api.rb
class API < Grape::API
prefix 'api'
mount V1::User
end
app/api/v1/user.rb
module V1
class User < Grape::API
before { restrict_access! }
version 'v1', using: :path, vendor: 'martin', cascade: false
helpers do
include ApiHelpers
end
format :json
desc 'Returns pong.'
get :users do
users = User.all
present :users, users, with: V1::Entities::Users
end
end
end
application.rb
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module AngularCRUD
class Application < Rails::Application
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
config.assets.initialize_on_precompile = true
config.assets.paths << Rails.root.join('vendor', 'assets', 'components')
config.autoload_paths += %W(#{config.root}/lib)
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL'
}
# Auto-load API and its subdirectories
config.paths.add 'app/api', glob: '**/*.rb'
config.autoload_paths += Dir["#{Rails.root}/app/api/*"]
end
end
Metadata
Metadata
Assignees
Labels
No labels