title: ActiveModel::ForbiddenAttributesError use only params
body: <p>I'm getting <code>ActiveModel::ForbiddenAttributesError in MicropostsController#create</code> on line #2 in the create action.</p>
  
  <p>Tried also changing <code>f.hidden_field</code> to <code>hidden_field_tag</code> but still getting <code>ForbiddenAttributesError</code></p>
  
  <p>micropost_controller</p>
  
  <pre><code>  def create
      tag = Tag.find(params[:micropost][:tag_id])
      @micropost = tag.microposts.build(params[:micropost])
      @micropost.user_id = current_user.id
      if @micropost.save
        flash[:success] = "Posted!"
        redirect_to root_path
      else
        render 'static_pages/home'
      end
    end
  </code></pre>
  
  <p>tags_controller</p>
  
  <pre><code>  def details
      @tag = Tag.find(params[:id])
      @microposts = @tag.microposts
      @micropost = @tag.microposts.build if sign_in?
    end
  </code></pre>
  
  <p>micropost form</p>
  
  <pre><code>&lt;%= form_for(@micropost) do |f| %&gt;
    &lt;%= render 'shared/error_messages', object: @micropost %&gt;
    &lt;div class="field"&gt;
      &lt;%=  f.text_area :content, placeholder: "Your post" %&gt;
      &lt;%=  f.hidden_field :tag_id %&gt;
    &lt;/div&gt;
    &lt;%= f.submit "Post", class: "btn btn-large btn-primary" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>in tags.rb</p>
  
  <pre><code>  has_many :microposts, dependent: :destroy
  </code></pre>
  
  <p>in microposts.rb</p>
  
  <pre><code>  belongs_to :user
    belongs_to :tag
  </code></pre>