2
我正在关注http://ruby.railstutorial.org/从我的应用程序目录中运行此命令但收到下面的错误。我已经搜索过,但可以找出如何解决。生成脚手架Micropost的错误
$ rails generate scaffold Micropost content:string user_id:integer
这是错误:
/Users/bryonthomas/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `load': /Users/bryonthomas/Code/demo_app/config/routes.rb:4: syntax error, unexpected '.' (SyntaxError)
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `block in load'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in `load'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application.rb:127:in `block in reload_routes!'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application.rb:127:in `each'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application.rb:127:in `reload_routes!'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application.rb:120:in `block in routes_reloader'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/file_update_checker.rb:32:in `call'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/activesupport-3.0.9/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application/finisher.rb:51:in `block (2 levels) in <module:Finisher>'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application/finisher.rb:52:in `call'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application/finisher.rb:52:in `block in <module:Finisher>'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `block in run_initializers'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
from /Users/bryonthomas/Code/demo_app/config/environment.rb:5:in `<top (required)>'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application.rb:103:in `require'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/application.rb:103:in `require_environment!'
from /Users/bryonthomas/.rvm/gems/[email protected]/gems/railties-3.0.9/lib/rails/commands.rb:16:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我的routes.rb是:
DemoApp::Application.routes.draw do
resources :users
.
.
.
end
您的路线代码有错误(请在第4行),请张贴代码。 –
这里是routes.rbDemoApp :: Application.routes.draw do 资源:用户 。 。 。 结束 – Bryon
你可以编辑你的文章并把路线放在那里吗?这将更具可读性。 –