如果您将功能更改为以下内容,它应该可以工作......
def save_page
system("/usr/bin/curl -O http://127.0.0.1:3000/category_plist")
end
要测试这样的命令,请退出本地网络服务器并运行“rails 控制台”,从那里您可以输入这样的命令并立即获得响应......
$ rails console
Loading development environment (Rails 3.1.0.rc4)
1.9.2-p290 :001 > puts system("ls -l")
total 56
-rw-r--r--@ 1 creativetechnologist staff 212 3 Feb 2011 Capfile
-rw-r--r--@ 1 creativetechnologist staff 924 6 Feb 2012 Gemfile
-rw-r--r--@ 1 creativetechnologist staff 3072 6 Feb 2012 Gemfile.lock
-rw-r--r--@ 1 creativetechnologist staff 3943 16 Oct 23:16 MOR_git.tmproj
-rw-r--r--@ 1 creativetechnologist staff 18 12 Jul 19:06 README
-rw-r--r--@ 1 creativetechnologist staff 267 30 Aug 2011 Rakefile
drwxr-xr-x 7 creativetechnologist staff 238 30 Aug 2011 app
drwxr-xr-x 11 creativetechnologist staff 374 13 Sep 2011 config
-rw-r--r--@ 1 creativetechnologist staff 157 30 Aug 2011 config.ru
drwxr-xr-x 6 creativetechnologist staff 204 3 Feb 2011 db
drwxr-xr-x 3 creativetechnologist staff 102 3 Feb 2011 doc
drwxr-xr-x 4 creativetechnologist staff 136 3 Feb 2011 key
drwxr-xr-x 6 creativetechnologist staff 204 7 Sep 2011 lib
drwxr-xr-x 6 creativetechnologist staff 204 11 Mar 2012 log
drwxr-xr-x 3 creativetechnologist staff 102 30 Aug 2011 logs
drwxr-xr-x 13 creativetechnologist staff 442 6 Feb 2012 public
drwxr-xr-x 3 creativetechnologist staff 102 3 Feb 2011 script
drwxr-xr-x 8 creativetechnologist staff 272 3 Feb 2011 test
drwxr-xr-x 6 creativetechnologist staff 204 3 Feb 2011 tmp
drwxr-xr-x 3 creativetechnologist staff 102 3 Feb 2011 vendor
true
=> nil
1.9.2-p290 :002 >
希望有帮助。