title: Using params in rails gives ArgumentError: When assigning attributes, you must pass a hash as an argument
body: <p>I am using params which is a hash and still, I get this error stating ArgumentError (When assigning attributes, you must pass a hash as an argument.) Here are parts of my code:</p>
  
  <p><strong>Project/app/controllers/index_controller.rb:</strong></p>
  
  <pre><code>class IndexController &lt; ApplicationController
      helper_method :create
      def create
          @post = Post.new(params[:data_value])
      end
  end
  </code></pre>
  
  <p><strong>Project/app/models/post.rb:</strong></p>
  
  <pre><code>class Post &lt; ActiveRecord::Base
      belongs_to :user
      has_many :posts, :dependent =&gt; :delete_all
  end
  </code></pre>
  
  <p><strong>Project/config/routes.rb:</strong></p>
  
  <pre><code>Rails.application.routes.draw do
    root "index#index"
    post "/customurl", to: "index#create"
  end
  </code></pre>
  
  <p>ajax request from <strong>Project/app/assets/javascripts/index.js:</strong></p>
  
  <pre><code>$.ajax({
      url : "/customurl",
      type : "post",
      data : { data_value: "Hello" }
  })
  </code></pre>
  
  <p>When I print the return value of <code>create</code> method from views, it displays a random hex value for each call. Can anyone please help me by letting me know what's the mistake I am doing.</p>