0

嘿伙计们,我正在通过 schneems https://github.com/Stephenitis/ruby_view_server上这节课(请参阅自述文件)

我进入第 6 步)与您的服务器交谈,我的意思是添加 <%= @request.query.inspect %>

当我运行 $ ruby​​ page_generator_with_layout.rb

我收到这个错误

  - Converting .html.erb to html with Layout !!!
(erb):14:in `process_erb': undefined method `query' for nil:NilClass (NoMethodError)
    from /Users/Jupitor/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/erb.rb:838:in `eval'
    from /Users/Jupitor/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/erb.rb:838:in `result'
    from page_generator_with_layout.rb:6:in `process_erb'
    from page_generator_with_layout.rb:24:in `block in <main>'
    from page_generator_with_layout.rb:13:in `each'
    from page_generator_with_layout.rb:13:in `<main>'
4

1 回答 1

1

您不再需要运行 $ ruby​​ page_generator_with_layout.rb,因为服务器直接查看视图(.html.erb 文件),而不是 .html;(如果我错了,请纠正我,因为我自己现在正在做这个练习,并且之前犯了同样的错误)

于 2013-06-17T23:03:46.777 回答