warning: Can't mass-assign protected attributes (using paperclip)
I think attachment doesn't saving in the database because of this warning. I tried different variants of attr_accessible attributes, but I always get this warning or error "unknown attribute: upfile". So, my code:


post.rb

    class Post < ActiveRecord::Base
      has_many :comments, :as => :commentable
      belongs_to :user
      has_many :attaches, :as => :uploadable, :dependent => :destroy
  
      attr_accessible :title, :body, :commentable, :attach_attributes
      accepts_nested_attributes_for :attaches
    end


attach.rb:

    require 'paperclip'
    class Attach < ActiveRecord::Base
      belongs_to :uploadable, :polymorphic => true
  
      has_attached_file :upfile
      attr_accessible :upfile
    end

Using ruby 1.9.3, rails 3.2.0, paperclip 2.5.2
warning: Can't mass-assign protected attributes (using paperclip)
===

I think attachment doesn't saving in the database because of this warning. I tried different variants of attr_accessible attributes, but I always get this warning or error "unknown attribute: upfile". So, my code:


post.rb

    class Post < ActiveRecord::Base
      has_many :comments, :as => :commentable
      belongs_to :user
      has_many :attaches, :as => :uploadable, :dependent => :destroy
  
      attr_accessible :title, :body, :commentable, :attach_attributes
      accepts_nested_attributes_for :attaches
    end


attach.rb:

    require 'paperclip'
    class Attach < ActiveRecord::Base
      belongs_to :uploadable, :polymorphic => true
  
      has_attached_file :upfile
      attr_accessible :upfile
    end

Using ruby 1.9.3, rails 3.2.0, paperclip 2.5.2