1

我正在使用acts_as_commentable。这就是模型添加评论的方式:

 commentable = Post.create
 commentable.comments.create(:title => "First comment.", :comment => "This is the first comment.")

宝石细节可以在这里找到:

https://github.com/jackdempsey/acts_as_commentable

在formtastic中,我通常会传递模型,然后是输入字段......这仍然有效吗?

 <%= semantic_form_form 'review' do |form| %>

     <%= form.input :title %>
     <%= form.input :comment %>
 <% end %>

在控制器中......?

  commentable.comments.create(params(:review))

我不确定这是否会传递可用的哈希值....谢谢!

4

1 回答 1

0

是的,这应该有效。你试过了吗?

就像 Rails' 一样form_for,您可以传入:remote => true远程表单的选项。

于 2011-06-09T12:17:47.520 回答