尽量明确地说明你要的形式来实现点什么路径(这应该是messages#create
动作):
<%= form_for(@message) :url => messages_path, :method => :post do |f| %>
<div class="field">
<%= f.label :to %><br />
<%= f.email_field :to %>
</div>
<div class="field">
<%= f.label :topic %><br />
<%= f.text_field :topic %>
</div>
<div class="field">
<%= f.label :body %><br />
<%= f.text_area :body %>
</div>
<button type="submit" class="btn primary">Send</button>
<button type="reset" class="btn">Cancel</button>
<% end %>
这是假设你有这样的在你的routes.rb
文件:
resources :messages
此外,请确保您通过所需字段ActsAsMessageable:https://github.com/LTe/acts-as-messageable/wiki/Example-controller
请发布链接到您正在使用的gem的github主页。 – 2012-01-10 12:20:21
@Planetpluto请在下面看到我的回答,看看这种方法是否会起作用 – iwasrobbed 2012-01-12 04:22:56