Problemy z zapisywaniem tagów w Ruby on Rails 4 za pomocą acts_as_taggable

Usiłuję zaimplementować act_as_taggable w mojej aplikacji Rails 4 (na modelu z mikropostami), ale program nie zapisuje tagów, które dlatego nie są widoczne. Tabele tagów i tagów zostały zgrabione i istnieją w bazie danych, ale żaden z kodu, który zaimplementowałem, nie wydaje się zapisywać tagu lub tworzyć tagu po przesłaniu formularza. Podążyłem za krokami w tymseminarium blisko, ale coś nie działa.

Nie jestem pewien, czy jest to problem związany z szynami 4 i / lub jest związany z brakiem kodu „attr_accessible” używanego w szynach. Ponieważ przykład kodu nie określa dodawania czegokolwiek do tabeli mikropostów, mogę założyć, że połączenie zostało wykonane gdzie indziej, ale gdzie i jak powinienem to naprawić, nie wiem (być może w microposts_helper.rb?).

Z góry dziękuję. Każda pomoc jest bardzo mile widziana.

Odpowiednie fragmenty kodu

Gemfile

...

gem 'acts-as-taggable-on', '~> 2.4.1'

...

microposts.rb

   class Micropost < ActiveRecord::Base     
   belongs_to :user  
   acts_as_taggable   
   acts_as_taggable_on :tags
   ... 
   end

microposts_controller.rb

  before_action :signed_in_user, only: [:create, :destroy]
  before_action :correct_user,   only: :destroy

  def index
    if params[:tag]
      @microposts = Micropost.tagged_with(params[:tag])
    else
      @microposts = Micropost.all
    end
  end

  def create
    @micropost = current_user.microposts.build(micropost_params)
    if @micropost.save
      flash[:success] = "Micropost created!"
      redirect_to current_user
    else
      @feed_items = []
      render 'users/show'
    end
  end

  def destroy
    @micropost.destroy
    redirect_to user_url
  end

  def tagged
    if params[:tag].present? 
      @microposts = Micropost.tagged_with(params[:tag])
    else 
      @microposts = Micropost.postall
    end  
  end

  private

    def micropost_params
      params.require(:micropost).permit(:content)
    end

    def correct_user
      @micropost = current_user.microposts.find_by(id: params[:id])
      redirect_to user_url if @micropost.nil?
    end
end

microposts_helper.rb

module MicropostsHelper
    include ActsAsTaggableOn::TagsHelper
end

_microposts_form.html.rb

<%= form_for(@micropost) do |f| %>
  ...
  <div class="field">
    ...
    <%= f.label :tags %>
    <%= f.text_field :tag_list %>
  </div>
  <%= f.submit "Post", class: "btn btn-large btn-primary" %>
<% end %>

_micropost.erb.html

<li>
  <span class="content"><%= micropost.content %></span>
  <span class="tags">
    <%= micropost.tag_list %>
  </span>
...
</li>

schema.rb

...
create_table "microposts", force: true do |t|
    t.string   "content"
    t.integer  "user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "microposts", ["user_id", "created_at"], name: "index_microposts_on_user_id_and_created_at"
...
  create_table "taggings", force: true do |t|
    t.integer  "tag_id"
    t.integer  "taggable_id"
    t.string   "taggable_type"
    t.integer  "tagger_id"
    t.string   "tagger_type"
    t.string   "context",       limit: 128
    t.datetime "created_at"
  end

  add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id"
  add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"

  create_table "tags", force: true do |t|
    t.string "name"
  end
...

routes.rb

Dev::Application.routes.draw do
    ...
    resources :microposts, only: [:create, :destroy]
    ...
    match 'tagged', to: 'microposts#tagged', :as => 'tagged', via: 'get' 
end

questionAnswers(2)

yourAnswerToTheQuestion