Trying to add a route for Rack class as follows:
match '/sms' => MsgReceiver
the Rack class is:
# /lib/msg_receiver.rb
class MsgReceiver
def self.call(env)
[200, {}, "test"]
# render
end
end
The error I'm getting:
uninitialized constant MsgReceiver (NameError)
Why am I getting the error, Do I have to define MsgReceiver any开发者_如何学编程where?
Looking at http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/, it appears that you need...
match '/sms', :to => MsgReceiver
Based on the error message you're getting, however, I'm not sure if this will actually resolve the problem. Perhaps, you also need to add require 'msg_receiver'
at the top of your routes file?
精彩评论