title: ActiveRecord::UnknownAttributeError
body: <p>I'm trying to create hotel with some fields, one of the fields is photo, i want to use multiple files upload with carrierwave and nested_form. I found this <a href="http://lucapette.com/rails/multiple-files-upload-with-carrierwave-and-nested_form/" rel="noreferrer">article</a>
  and have some result.</p>
  
  <p>When i'm on <a href="http://img404.imageshack.us/img404/3474/8ta1.png" rel="noreferrer">/hotels/new</a>, filling fields, choosing photos 
  and press submit, getting <strong>ActiveRecord::UnknownAttributeError in HotelsController#create unknown attribute: attachable_type.</strong> 
  <strong>Console</strong></p>
  
  <pre><code>Started POST "/hotels" for 127.0.0.1 at 2013-09-27 17:35:18 +0300
  Processing by HotelsController#create as HTML
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"+1T2tuygSnj8unOKkXkRWI4L7KvDE
  9PPHrqvag7KmIQ=", "hotel"=&gt;{"title"=&gt;"dsa", "address"=&gt;"asd", "star_rating"=&gt;"2"
  , "breakfast"=&gt;"Not include", "price_for_room"=&gt;"sadas", "room_description"=&gt;"Gr
  eat room", "attachments_attributes"=&gt;{"1380289954031"=&gt;{"file"=&gt;#&lt;ActionDispatch
  ::Http::UploadedFile:0xa5d546c @original_filename="11374.jpg", @content_type="im
  age/jpeg", @headers="Content-Disposition: form-data; name=\"hotel[attachments_at
  tributes][1380289954031][file]\"; filename=\"11374.jpg\"\r\nContent-Type: image/
  jpeg\r\n", @tempfile=#&lt;File:/tmp/RackMultipart20130927-7077-50zkol&gt;&gt;, "_destroy"
  =&gt;"false"}, "1380289972216"=&gt;{"file"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0xa5d
  53a4 @original_filename="357175.jpg", @content_type="image/jpeg", @headers="Cont
  ent-Disposition: form-data; name=\"hotel[attachments_attributes][1380289972216][
  file]\"; filename=\"357175.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#&lt;F
  ile:/tmp/RackMultipart20130927-7077-dlkmwk&gt;&gt;, "_destroy"=&gt;"false"}}}, "commit"=&gt;
  "Done"}
  Completed 500 Internal Server Error in 109ms
  
  ActiveRecord::UnknownAttributeError (unknown attribute: attachable_type):
    app/controllers/hotels_controller.rb:15:in `new'
    app/controllers/hotels_controller.rb:15:in `create' 
  ...
  </code></pre>
  
  <p><strong>Model hotel.rb</strong>   </p>
  
  <pre><code>class Hotel &lt; ActiveRecord::Base
    attr_accessible :address, :breakfast, :price_for_room, :room_description,
                  :star_rating, :title, :attachments_attributes
  
    has_many :attachments, :as =&gt; :attachable
    accepts_nested_attributes_for :attachments
  end
  </code></pre>
  
  <p><strong>Model attachment.rb</strong></p>
  
  <pre><code>class Attachment &lt; ActiveRecord::Base
    attr_accessible :file  
    belongs_to :attachable, :polymorphic =&gt; true
    mount_uploader :file, FileUploader
  end
  </code></pre>
  
  <p><strong>hotels_controller.rb</strong></p>
  
  <pre><code>...
        def new
          @hotel = Hotel.new
        end
        def create
          @hotel = Hotel.new(params[:hotel])
          if @hotel.save
            redirect_to hotels_path, notice: "Nice, you added new hotel " + @hotel.title
          else
            render "new"
          end  
        end
  </code></pre>
  
  <p><strong>_form.rb</strong></p>
  
  <pre><code>&lt;%= nested_form_for @hotel, :html =&gt; {:multipart =&gt; true}  do |f| %&gt;
    ...
    &lt;%= f.fields_for :attachments do |attachment_form|%&gt;    
      &lt;%= attachment_form.label :file %&gt;
      &lt;%= attachment_form.file_field :file %&gt;
      &lt;%= attachment_form.link_to_remove "Remove this photo" %&gt;
    &lt;% end %&gt;
    &lt;%= f.link_to_add "Add photo", :attachments %&gt;
    &lt;%= f.submit 'Done', class: 'btn btn-success' %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Any ideas guys? What am I doing wrong here?</p>