ruby-on-rails - Ruby on Rails 中 Look#input 中的语法错误

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

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

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  <=

问题是什么?

最佳答案

尝试

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

和你的文本字段

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

关于ruby-on-rails - Ruby on Rails 中 Look#input 中的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8719449/

相关文章:

linux - Linux 上的 NetBeans 标准输出和标准错误

ruby-on-rails - 使用 VAPID : 400/401 Unauthorized Registration 进行网络推送

ruby-on-rails - Rails,通过自定义的唯一字段引用关联

ruby - Visual Studio 代码 : Disabling Error/Warning checks in for specific file type

ruby-on-rails - 在 Ruby on Rails 中为子域定义默认路由

linux - 在 bash-3.2$ 中找不到命令

linux - oracle 即时客户端 12.1 SP2-0667 : Message file sp1<lang>. 未找到 msb

javascript - 为什么我的嵌入式 ruby​​ json 字符串在 View 中解析时会使用 html 实体进行编码?

ruby-on-rails - Secrets.yml 与 ENV 变量与选项?

mysql - Rails 在连接模型上查询用户名