title: Rails strong parameters not recognizing my params
body: <p>I created a form to add a record to <code>:vote</code> model that belongs to <code>:article</code> model. As you can see below, the form to create the <code>:vote</code> record is in a <code>:article</code> view. In not using nested routes for these models so instead of using the <code>form_for</code> helper, I'm using plain <code>form_tags</code>. My problem is that <code>strong_parameters</code> is not allowing my hidden field through.</p>
  
  <pre><code>&lt;p id="notice"&gt;&lt;%= notice %&gt;&lt;/p&gt;
  
  &lt;p&gt;
  &lt;strong&gt;Title:&lt;/strong&gt;
  &lt;%= @article.title %&gt; 
  &lt;/p&gt;
  
  &lt;p&gt;
  &lt;strong&gt;Body:&lt;/strong&gt;
  &lt;%= @article.body %&gt;
  &lt;/p&gt;
  
  &lt;p&gt;
  &lt;strong&gt;User:&lt;/strong&gt;
   &lt;%= @article.user_id %&gt;
  &lt;/p&gt;
  
  &lt;%= form_tag("/vote/#{@article.id}", method: :post) do -%&gt;
  &lt;%= hidden_field_tag 'vote[value]', 1 %&gt;
  &lt;%= submit_tag 'Up vote' %&gt;
  &lt;% end -%&gt;
  
  &lt;%= link_to 'Edit', edit_article_path(@article) %&gt; 
  &lt;%= link_to 'Back', articles_path %&gt; 
  </code></pre>
  
  <p>As you can see in the controller code, I have white listed the the param and the log data show the post body coming in the right format for the parameters hash but it won't reach my create action.</p>
  
  <pre><code>class VotesController &lt; ApplicationController
  
  def create
      @article = Article.find(params[:id])
      @vote = Vote.new(params[:strong_vote])
      @vote.user_id = current_user.id
      @vote.article_id = @article.id
      @vote.save
      redirect_to @article
  
  end
  
  
  private
  
  def strong_vote
      params.require(:vote).permit(:value)
  end
  
  
  end
  
       Processing by VotesController#create as HTML Parameters:{"utf8"=&gt;"✓","authenticity_token"=&gt;"Y6eBxpwGXGdT2toeUrxAlLW58Hj8Eux+SvoWeVUoYa8=","vote"=&gt;{"value"=&gt;"1"}, "commit"=&gt;"Up vote","id"=&gt;"7"}
       Article Load (0.1ms)  SELECT  "articles".* FROM "articles"  WHERE  "articles"."id" = ? LIMIT 1  [["id", 7]]
       User Load (0.1ms)  SELECT  "users".* FROM "users"  WHERE"users"."id" = 1  ORDER BY "users"."id" ASC LIMIT 1
       Rendered text template (0.0ms)
       Completed 200 OK in 7ms (Views: 1.0ms | ActiveRecord: 0.4ms)
  </code></pre>
  
  <p>Here are my routes in case they may be helpful.</p>
  
  <pre><code>devise_for :users
  root 'articles#index'
  
  resources :articles
  
  post '/vote/:id' =&gt; 'votes#create'
  </code></pre>
  
  <p>Update: I tried your answer doz87 but I get the following error:</p>
  
  <pre><code>ArgumentError in VotesController#create
  When assigning attributes, you must pass a hash as an argument.
  
  Extracted source (around line #5):
  3
  4
  5
  6
  7
  8
  
      def create
          @article = Article.find(params[:id])
          @vote = Vote.new(:strong_vote)
          @vote.user_id = current_user.id
          @vote.article_id = @article.id
          @vote.save
  
  Rails.root: /home/w/Folders/playground/ruby/voter
  
  Application Trace | Framework Trace | Full Trace
  app/controllers/votes_controller.rb:5:in `create'
  Request
  
  Parameters:
  
  {"utf8"=&gt;"✓",
   "authenticity_token"=&gt;"AVKHgcsOwQhwWJGfSGQhIL1Lbr7yhSRaGKTrxuLcAuo=",
   "vote"=&gt;{"value"=&gt;"1"},
   "commit"=&gt;"Up vote",
   "id"=&gt;"7"}
  </code></pre>