Look#input中的SyntaxError

时间:2012-01-04 00:29:48

标签: ruby ruby-on-rails-3

我有问题:

/home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html:9: syntax error, unexpected '=', expecting tASSOC
...tag  :action => 'at', :method = > post);@output_buffer.safe_...
...                               ^

/home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html:12: syntax error, unexpected tSTRING_BEG, expecting ')'..._field_tag "text2", nil, :size" => 30);@output_buffer.safe_c...
...                               ^

/home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html:15: syntax error, unexpected tIDENTIFIER, expecting ')' <input type="submit"/>
                         ^

/home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html:15: unterminated string meets end of file

/home/rene/ruby_dev/ch05/txt2fields/app/views/look/input.html:15: syntax error, unexpected $end, expecting ')'

提取的来源(第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:     <%= form_tag  :action => 'at', :method = > post%>
10:       Veuillez saisir votre nom.
11:       <br>
12:       <%= text_field_tag "text2", nil, :size" => 30%>

1 个答案:

答案 0 :(得分:2)

在您的代码中,第9行

:method = > post%>

应该是

:method => post%>

有一个不必要的空间。


第12行

:size" => 30

应该是

:size => 30

符号不以引号结尾。