title: Ruby on Rails ActiveModel::MassAssignmentSecurity::Error
body: <p>I am trying to create line_items but I am getting this error</p>
  
  <p>app/controllers/line_items_controller.rb:52:in `create'</p>
  
  <p>which references to this line</p>
  
  <pre><code>Can't mass-assign protected attributes: product
  
  @line_item = @cart.line_items.build(:product =&gt; product)
  </code></pre>
  
  <p>the full code is below </p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
  
    attr_accessible :description, :image_url, :price, :title
  
     default_scope :order =&gt; 'title'
  
     has_many :line_items
     before_destroy :ensure_not_referenced_by_any_line_item
     #more code here...
     private
  
     # ensure that there are no line items referencing this product
     def ensure_not_referenced_by_any_line_item
       if line_items.empty?
         return true
       else
         errors.add(:base, 'Line Items present')
         return false
        end
     end
  
  end
  
  
  
  def create
     @cart = current_cart
     product = Product.find(params[:product_id])
     #the error is HERE!!
     @line_item = @cart.line_items.build(:product =&gt; product)
  </code></pre>