I started learning rails using 'Agile Web Development with Rails, 4th Edition'
withrails 3.2.7
and ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux]
.
When i tried to edit an html form with
我开始使用带有rails 3.2.7和ruby 1.9.3p448(2013-06-27修订版41675)[i686-linux]的'Agile Web Development with Rails,第4版'来学习rails。当我尝试编辑html表单时
<%= f.text_area :description :rows=>6 %>
it returned an error
它返回了一个错误
/media/ashku/New Volume/RoR/depot/app/views/products/_form.html.erb:19: syntax error, unexpected ':', expecting ')'
...= ( f.text_area :description :rows=>6 );@output_buffer.safe...
then i tried to change the :rows=>6 to rows: 6
but the results where the same
然后我试着改变:rows => 6到行:6但结果在哪里相同
Discussion here suggests it as problem with JSON
这里的讨论表明它是JSON的问题
controller code is given here
控制器代码在这里给出
so how to resolve this problem ?
那么如何解决这个问题呢?
3 个解决方案
#1
2
You have missed the comma(,) after tag name ie.(:description). So replace your tag with following and try to run..
您错过了标记名称之后的逗号(,),即。(:description)。所以用以下内容替换你的标签并尝试运行..
<%= f.text_area :description, :rows => 6 %>
#2
2
You're missing a comma in between :description
, and :rows
.
您之间缺少逗号:description和:rows。
#3
1
You can use "Better Errors" gem for debugging in development env., this is a better tool to find errors in good way. read about them from http://railscasts.com/episodes/402-better-errors-railspanel?view=asciicast
您可以使用“Better Errors”gem在开发环境中进行调试,这是一种更好地查找错误的工具。从http://railscasts.com/episodes/402-better-errors-railspanel?view=asciicast上了解它们
#1
2
You have missed the comma(,) after tag name ie.(:description). So replace your tag with following and try to run..
您错过了标记名称之后的逗号(,),即。(:description)。所以用以下内容替换你的标签并尝试运行..
<%= f.text_area :description, :rows => 6 %>
#2
2
You're missing a comma in between :description
, and :rows
.
您之间缺少逗号:description和:rows。
#3
1
You can use "Better Errors" gem for debugging in development env., this is a better tool to find errors in good way. read about them from http://railscasts.com/episodes/402-better-errors-railspanel?view=asciicast
您可以使用“Better Errors”gem在开发环境中进行调试,这是一种更好地查找错误的工具。从http://railscasts.com/episodes/402-better-errors-railspanel?view=asciicast上了解它们