这是一个全新的项目.这是我运行的确切命令:
rails new MyProjectbundle installrails generate controller Image我添加了这一条路线:
root :to => "image#process"我已将此功能添加到ImageController(image_controller.rb)
def process
render :nothing => true
end
Run Code Online (Sandbox Code Playgroud)
最后我删除了默认值index.html.当我运行项目时,它有一个错误,说进程需要0参数,而不是1.所以我修改方法告诉我试图发送到进程的参数.
def process(arg)
p arg
render :nothing => true
end
Run Code Online (Sandbox Code Playgroud)
字符串"process"被打印到屏幕上.我以前做过几个Rails项目,从未遇到过这个.我错过了某个地方吗?这是Rails 3.0.10中的新功能吗?或者可能是由Ruby 1.9.2引起的?我想我通常使用1.8.7.