【问题标题】:SyntaxError in Look#input in Ruby on RailsRuby on Rails 中 Look#input 中的语法错误
【发布时间】:2012-01-03 22:18:51
【问题描述】:

我是 RoR 的新手,我使用“Débuter avec Ruby on Rails”进行测试。它是 Steven Holzner 的法语“Begining Ruby on Rails”。我在Look#input 中有语法错误:

Showing /home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html where line #9 raised:

/home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html:9: syntax error, unexpected ',', expecting ')'
...rt_form_tag ({:action => "at"}, {:method = > "post"} ));@out...
...                               ^

/home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html:9: syntax error, unexpected '}', expecting ')'
... => "at"}, {:method = > "post"} ));@output_buffer.safe_conca...
...                               ^

/home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html:12: syntax error, unexpected ',', expecting ')'
...end= ( text_field_tag ("text2", "", ["size" => 30]) );@outpu...
...                               ^

提取的源代码(第 9 行附近):

6:     <h1>Les champs de saisie (champs de texte) version 2</h1>
7:     Cette application Ruby on Rails lit du texte saisi.
8:     <br>
9:     <%= start_form_tag ({:action => "at"}, {:method = > "post"} )%>
10:       Veuillez saisir votre nom.
11:       <br>
12:       <%= text_field_tag ("text2", "", ["size" => 30]) %>

模板包含的痕迹:

app/views/look/input.html  <=

有什么问题?

【问题讨论】:

    标签: ruby-on-rails ruby linux ubuntu-11.04


    【解决方案1】:

    试试

    form_tag :action => 'at', :method => post
    

    对于您的文本字段

    text_field_tag "text2", nil, :size => 30
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-31
      • 1970-01-01
      • 2015-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-11
      相关资源
      最近更新 更多