【发布时间】:2016-10-12 22:46:28
【问题描述】:
我是 Ruby on Rails 的新手,正在努力深入了解 MVC 的工作原理。
我做了以下事情:
rails new bubblesman
rails generate controller bubble
在我的气泡控制器中,我创建了一个方法如下:
def available
puts "YEP!!!!!!"
end
我将以下内容放入我的路线文件中:
'welcome' => 'bubble#available'
我导航到http://localhost:3000/welcome 我收到以下错误:
ActionController::UnknownFormat (BubbleController#available is missing a template for this request format and variant.
request.formats: ["text/html"]
request.variant: []
NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not… nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot.):
我也不明白的是,如果我把它放在我的辅助控制器而不是我的主控制器中,它一切正常。
【问题讨论】:
标签: ruby-on-rails ruby