0

I've been following this post

http://martinciu.com/2011/01/mounting-grape-api-inside-rails-application.html

I put the module into the lib directory and added the line to routes.rb like shown

When I do

rails s

I get an error, saying

uninitialized constant MyApp (NameError)

What's missing? Do I need to put the module some place else? Or let rails know somehow where it is?

dB.
  • 4,700
  • 2
  • 46
  • 51
EasierSaidThanDone
  • 1,877
  • 4
  • 20
  • 29

2 Answers2

3

The author of that blogpost clarifies that problem in the comments:

You can add 'require "lib/api" to your config/routes.rb file or you can require automatically all files from lib directory by adding this line to your config/application.rb;

config.autoload_paths += %W(#{config.root}/lib)

alf
  • 18,372
  • 10
  • 61
  • 92
0

Well ok, it's easy. I forgot to require 'myApp' in routes.rb....

soegaard
  • 30,661
  • 4
  • 57
  • 106
EasierSaidThanDone
  • 1,877
  • 4
  • 20
  • 29