运行: Apache 2.2.3 Ruby 1.8.7 Rails 2.3.4 乘客2.2.5
错误讯息:
/var/www/derscheidfamily/app/controllers/greetings_controller.rb:14: syntax error, unexpected '/', expecting '\n' or ';'
def app/controllers
^
/var/www/derscheidfamily/app/controllers/greetings_controller.rb:20: syntax error, unexpected '/', expecting '\n' or ';'
def app/helpers
^
Exception class:
SyntaxError
Application root:
/var/www/derscheidfamily
greetings_controller如下:
class GreetingsController < ApplicationController
def hello
end
def exists
end
def app
end
def exists
end
def app/controllers
end
def exists
end
def app/helpers
end
def create
end
def app/views/greetings
end
def exists
end
def test/functional
end
def create
end
def app/controllers/greetings_controller.rb
end
def create
end
def test/functional/greetings_controller_test.rb
end
def create
end
def app/helpers/greetings_helper.rb
end
def create
end
def app/views/greetings/hello.html.erb
end
end
答案 0 :(得分:0)
这些不是有效的Ruby方法名称。
def app/controllers
end
def app/controllers/greetings_controller.rb
end
# etc...
除了可能需要阅读一些文档之外,我强烈建议您在干净的Rails项目中运行它:
./script/generate scaffold greetings
然后看看它产生了什么。您可以通过这种方式了解基本Rails应用程序的结构。