今、私はこのようなフォームビューを持っています
<%=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
固定パラメータをフォームに渡す方法を教えてもらえますか?