Acts as Taggable on gem

I am trying to make an app with Rails 4.

I am trying to use gem 'acts-as-taggable-on', '~> 3.4'

I found this tutorial showing how to set it up:

https://www.reddit.com/r/rails/comments/2chtgw/tagging_in_rails_4/

I have an articles controller, which has included tag_list in the strong params:

def article_params
      params[:article].permit(:user_id, :body, :title, :image, :tag_list,
        comment_attributes: [:opinion])
    end

I have an articles form, with:

<%= simple_form_for(@article) do |f| %>
            <%= f.error_notification %>

                <div class="form-inputs">
                    <%= f.input :title,  autofocus: true %>
                    <%= f.input :body, :label => "Post", :input_html => {:rows => 10} %>
                    <%= f.input :image, :label => "Add an image" %>
                    <%= f.input :tag_list, :label => "Add tags" %>
                </div>

                <div class="form-actions">
                    <%= f.button :submit, "Submit & Publish", :class => 'formsubmit' %>
                </div>
        <% end %>

I have the table in my schema and have completed all the steps prior to the view integration in the reddit post.

When I try to check the form is working, I get this error:

undefined method `tag_list' for #<Article:0x007fad26cd9f30>

Can anyone see what's going wrong?

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

上一篇: 使用Acts通过Javascript提交Select2 Form in Rails

下一篇: 充当宝石上的标签