2012-02-01 37 views
2

一旦我用下面的代碼中的「form_tag('/ comments')」代替「form {:action =>」/ comments「}」:

=form_tag('/comments') 
    %fieldset 
     %input.comment_input{ :name => "comment[comment]", :size => 60, :type => "text" } 
     %input{ :name => "comment[activity_id]", :type => 'hidden', :value => "#{activity.id}" } 
     %button.post_coment_btn{ :type => "submit", :formmethod => "post"} Add Comment 

然後我得到了以下錯誤:

syntax error, unexpected keyword_ensure, expecting $end 

。 。在第18行,但包含上述文件的文件只有17行。我是否錯誤地使用了form_tag?

< - 更新 - >

使用的form_tag也由@Ben張表示只有工作,我其實很想去到「創造」的行動在「意見」控制器:

=form_tag :action => 'create', :controller => 'comments' do 

回答

10

試試這個

= form_tag :action => '/comments' do 
+0

了15分鐘,這一個...德哦! – 2012-03-19 18:43:04

相關問題