title: Ruby on Rails: Dropzone js, getting [object Object], but why?
body: <p>I'm getting [object Object] on my thumbnails (the background image is the area where you can click on to upload photos... I'm not sure how to load up the normal box similar to the example in <a href="http://www.dropzonejs.com/" rel="noreferrer">http://www.dropzonejs.com/</a>)</p>
  
  <p><img src="https://i.stack.imgur.com/LeHnM.jpg" alt="enter image description here"></p>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;%= simple_form_for @project do |f| %&gt;
  
    &lt;div class="dropzone dz-clickable dz-square" id="mydrop"&gt;
      &lt;div class="dz-default dz-message" data-dz-message=""&gt;&lt;/div&gt;
      &lt;div id="bi_previews"&gt;&lt;/div&gt;
      &lt;div class="fallback"&gt;
        &lt;%= f.file_field :beautiful_image %&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p><strong>CoffeeScript</strong></p>
  
  <pre><code>$(document).on 'ready page:load', -&gt;
    Dropzone.autoDiscover = false
    $('div#mydrop').dropzone 
      url: '/projects'
      previewsContainer: "#bi_previews"
      headers: "X-CSRF-Token" : $('meta[name="csrf-token"]').attr('content')
      paramName: "project[beautiful_image]"
      init: -&gt;
        @on 'success', (file, json) -&gt;
        @on 'addedfile', (file) -&gt;
        @on 'drop', (file) -&gt;
          alert 'file'
          return
        return
  </code></pre>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>Rails.application.routes.draw do
    devise_for :users
    resources :projects
  </code></pre>
  
  <p><strong>controller</strong></p>
  
  <pre><code>def project_params
    params.require(:project).permit(
      :user_id, :beautiful_image, :title_name, :remove_project_images_files, project_images_files: [],
      project_images_attributes: [:id, :project_id, :photo, :_destroy]).merge(user_id: current_user.id)
  end
  </code></pre>
  
  <p><strong>model</strong></p>
  
  <pre><code>has_attached_file :beautiful_image, :styles =&gt; { :large =&gt; "800x800&gt;", :medium =&gt; "500x500&gt;", :thumb =&gt; "150x150#" }, :default_url =&gt; "/images/:style/missing.png"
  validates_attachment_content_type :beautiful_image, content_type: /\Aimage\/.*\Z/
  </code></pre>
  
  <hr>
  
  <h1>EDIT</h1>
  
  <p>Posting controller per comment requets</p>
  
  <pre><code>def new
    @project = Project.new
    @gear = Gear.new
    @project.gears.build
    @project.project_images.build
  end
  
  def edit
    @project = Project.find(params[:id])
  end
  
  def create
    @project = Project.new(project_params)
  
    respond_to do |format|
      if @project.save
        format.html { redirect_to @project, notice: 'Project was successfully created.' }
        format.json { render :show, status: :created, location: @project }
      else
        format.html { render :new }
        format.json { render json: @project.errors, status: :unprocessable_entity }
      end
    end
  end
  </code></pre>