Cannot start rails project with grape

345 views
Skip to first unread message

John Rellis

unread,
May 14, 2013, 4:31:42 PM5/14/13
to ruby-...@googlegroups.com
Hey folks,

Help is needed.

I have a rails 3.2.13 app running on ruby 1.9.3.

I have added app/api/api.rb

require 'grape'

module Chat
  class API < Grape::API

  end
end


and my paths to application.rb

module Chatti
  class Application < Rails::Application

    config.paths.add "app/api", glob: "**/*.rb"
    config.autoload_paths += Dir["#{Rails.root}/app/api/*"]
.....

My routes.rb file is

Chatti::Application.routes.draw do

  mount Chat::API => '/api'

end



when I run my rails server I get the following error, does anybody know how to fix this??  Many thanks!

john@john-Precision-M4600:~/workspace/chatti$ rails server
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/john/workspace/chatti/config/routes.rb:3:in `block in <top (required)>': uninitialized constant Chat (NameError)
from /home/john/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `instance_exec'
from /home/john/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `eval_block'
from /home/john/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:267:in `draw'
from /home/john/workspace/chatti/config/routes.rb:1:in `<top (required)>'
from /home/john/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'

John Rellis

unread,
May 14, 2013, 4:34:09 PM5/14/13
to ruby-...@googlegroups.com
ehhhhhhhhhhhhhhhhhhhhhhhhhh i think i fixed it by changing api.rb to chat.rb.

ah, 3 hours I will never see again.  

Daniel Doubrovkine

unread,
May 14, 2013, 10:00:45 PM5/14/13
to ruby-...@googlegroups.com
Yeah, it's a Ruby lookup system that requires this ... sorry.


--
You received this message because you are subscribed to the Google Groups "Grape Framework Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-grape+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

dB. | Moscow - Geneva - Seattle - New York
dblock.org - @dblockdotorg

Reply all
Reply to author
Forward
0 new messages