论坛首页 入门技术论坛

页面中执行删除操作的链接中为什么不能使用“删除”字符?

浏览 2054 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-02-09  
代码如下:


<td class="ListActions">
            <%= link_to '显示', :action => 'show', :id => product %><br />
            <%= link_to '编辑', :action => 'edit', :id => product %><br />
            <%= link_to 'Destroy', {:action => 'destroy', :id => product},
                                :confirm => "删除确认?",:post => true %><br />
        </td>
这样写的话是正常的,但如果把 “Destroy” 改为 “删除” 就会出错
<td class="ListActions">
            <%= link_to '显示', :action => 'show', :id => product %><br />
            <%= link_to '编辑', :action => 'edit', :id => product %><br />
            <%= link_to '删除', {:action => 'destroy', :id => product},
                                :confirm => "删除确认?",:post => true %><br />
        </td>

compile error
./script/../config/../app/views/admin/list.rhtml:24: parse error, unexpected tIDENTIFIER, expecting ')'
_erbout.concat "            "; _erbout.concat(( link_to '删除', {:action => 'destroy', :id => product},
                                                                                    ^
./script/../config/../app/views/admin/list.rhtml:35: parse error, unexpected tIDENTIFIER, expecting ')'
_erbout.concat(( link_to '新增商品', :action => 'new' ).to_s); _erbout
                                  ^
./script/../config/../app/views/admin/list.rhtml:35: parse error, unexpected tIDENTIFIER, expecting ')'
_erbout.concat(( link_to '新增商品', :action => 'new' ).to_s); _erbout
                                                    ^
./script/../config/../app/views/admin/list.rhtml:35: unterminated string meets end of file
./script/../config/../app/views/admin/list.rhtml:35: parse error, unexpected $, expecting ')'
引用
引用
   发表时间:2007-02-09  
看一看网页的语言设置是否是utf-8? ror对中文支持不太好。
0 请登录后投票
   发表时间:2007-02-09  
http://www.iteye.com/topic/38773
0 请登录后投票
   发表时间:2007-02-09  
我使用的是ruby1.8.5
rails为1.2.1 默认的编码已经是utf-8的了,也不是不支持中文,如果我把“删除”改为“其它”也不会发生错误,实在弄不明白是为什么
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics