ruby on rails

i'm a RoR newbie and i'm trying to create a simple blog platform. Currenty i'm stuck on making a tagging possibility.

I've installed acts-as-taggable-on gem, added acts_as_taggable to my post model. Here is my form (based on this tutorial):

<%= form_for(@post) do |f| %>
  <div class="field">
    <%= f.label :title %><br />
    <%= f.text_field :title %>
  </div>
  <div class="field">
    <%= f.label :tag_list %><br />
    <%= f.text_field :tags, :tag_list %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

But when i'm trying to point by browser to ie edit form, all i get is the following error:

undefined method `merge' for :tag_list:Symbol 

Have you any idea what am i doing wrong? It's probably something really simple :) Thanks in advance!


I believe you just need to change your tag input field to

<%= f.text_field :tag_list %>

The acts-as-taggable-on gem creates a model attribute called tag_list which you should be able to access like any other model attribute in a form.

链接地址: http://www.djcxy.com/p/6104.html

上一篇: 如何使用捆绑器重新安装宝石

下一篇: 红宝石在轨道上