Ruby 使函数工作时出错
在demo\u api\u controller.rb中,我有类似于Ruby 使函数工作时出错,ruby,sinatra,Ruby,Sinatra,在demo\u api\u controller.rb中,我有类似于“post'/fetch\u specialities”的函数。 这里我调用“lib/facts.rb” 从中可以看出#1工作正常,并显示最新发布日期#2和3不起作用 获取以下错误: NoMethodError at /demo_api/fetch_specialities undefined method `get_zipcode_by_state' for #<DemoApiApp:0x4e686b1f> N
“post'/fetch\u specialities”的函数
。
这里我调用“lib/facts.rb”
从中可以看出#1工作正常,并显示最新发布日期#2和3不起作用
获取以下错误:
NoMethodError at /demo_api/fetch_specialities undefined method `get_zipcode_by_state' for #<DemoApiApp:0x4e686b1f>
NoMethodError at/demo\u api/fetch\u specialities未定义的方法'get\u zipcode\u by_state'for#
在您所在的范围内没有可用的按状态获取zipcode>方法。仔细检查您是否有可用的方法,并且没有输入错误
您可能需要重新启动服务器进程以获取lib
中的更改。您的操作是post
但您正在调用get…
请发布lib/facts.rb
-或至少是您定义的get zipcode\u by\u state
和get\u specs
的部分。这是答案吗?错误消息看起来像散文。如何重新启动服务?我是这里的noob。这取决于您是如何启动它的,但在开发过程中,它可能会在启动Sinatra应用程序的终端窗口中按CTRL+C,然后再次启动。我在linux上重新启动了httpd,但它仍然显示相同的错误。
NoMethodError at /demo_api/fetch_specialities undefined method `get_zipcode_by_state' for #<DemoApiApp:0x4e686b1f>