0

今、私はこのようなフォームビューを持っています

<%=form_for(([@community, @comment]), :remote => true, :class => 'form' ) do |f| %>
    <%= f.text_field :body, :id => "body", :class => "chat" %> 
    <button type="submit" class="btn">submit</button>
<% end %>

<% @comments.each do |comment| %>
    Request to <%= request(@community, comment.user) %> <br />
<% end %>

次に、レーキルートはこれを示しています

POST   /communities/:community_id/comments(.:format)     comments#create

application_helperは次のようにコーディングされています。create_community_comment_path(????????)正しいパスにも何を入れるべきかわかりません。

def request(community, user)
    if user
        nickname = user.profile.try(:nickname) 
        body = "You've got a request from " + nickname
        link_to "<span class='btn'>request</span>".html_safe , create_community_comment_path(community, body),{:method => :post}
    end
end

link_to固定パラメータをフォームに渡す方法を教えてもらえますか?

4

1 に答える 1

2

これを試して

link_to "<span class='btn'>request</span>".html_safe , create_community_comment_path(community, body, :parm1=>"Valu1", :parm2=>"Valu2"),{:method => :post}

于 2013-08-03T07:44:03.637 に答える