现在我有一个像这样的表单视图
<%=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 %>
然后rake routes显示这个
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
将固定参数传递给表单?