title: Errno::EINVAL in UsersController#create
body: <p>ruby version 2.2.4
  rails version 5.0.0.1</p>
  
  <p>gem 'paperclip', '~> 5.0.0.beta1'</p>
  
  <p>Hello,</p>
  
  <p>I want to  get this error when creating a user and I dont know why. I upload an avatar into the profile. After pressing the create-button the error below appears. Can you check please whats wrong with my program?</p>
  
  <pre><code>Errno::EINVAL (Invalid argument @ dir_s_mkdir - C:/Benutzer/Clemens/RubymineProjects/paperclip-example-master/public/system/users/:attachement):
  
  app/controllers/users_controller.rb:30:in `block in create'
  app/controllers/users_controller.rb:29:in `create'
    Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
    Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
    Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (10.0ms)
    Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
    Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.0ms)
    Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
    Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
    Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (1035.1ms)
  </code></pre>
  
  <p><strong>UserController</strong></p>
  
  <pre><code>class UsersController &lt; ApplicationController
    before_action :set_user, only: [:show, :edit, :update, :destroy]
  
    # GET /users
    # GET /users.json
    def index
      @users = User.all
    end
  
    # GET /users/1
    # GET /users/1.json
    def show
    end
  
    # GET /users/new
    def new
      @user = User.new
    end
  
    # GET /users/1/edit
    def edit
    end
  
    # POST /users
    # POST /users.json
    def create
      @user = User.new(user_params)
  
      respond_to do |format|
        if @user.save
          format.html { redirect_to @user, notice: 'Benutzer wurde erfolgreich erstellt.' }
          format.json { render :show, status: :created, location: @user }
        else
          format.html { render :new }
          format.json { render json: @user.errors, status: :unprocessable_entity }
        end
      end
    end
  
    # PATCH/PUT /users/1
    # PATCH/PUT /users/1.json
    def update
      respond_to do |format|
        if @user.update(user_params)
          format.html { redirect_to @user, notice: 'User was successfully updated.' }
          format.json { head :no_content }
        else
          format.html { render action: 'edit' }
          format.json { render json: @user.errors, status: :unprocessable_entity }
        end
      end
    end
  
    # DELETE /users/1
    # DELETE /users/1.json
    def destroy
      @user.destroy
      respond_to do |format|
        format.html { redirect_to users_url }
        format.json { head :no_content }
      end
    end
  
    private
      # Use callbacks to share common setup or constraints between actions.
      def set_user
        @user = User.find(params[:id])
      end
  
      # Never trust parameters from the scary internet, only allow the white list through.
      def user_params
        params.require(:user).permit(:name, :description, :avatar)
      end
  end
  </code></pre>
  
  <p><strong>user.rb</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_attached_file :avatar, 
      :path =&gt; ":rails_root/public/system/:class/:attachement/:id/:basename_:style.:extension",
      :url =&gt; "/system/:class/:attachement/:id/:basename_:style.:extension",
      style: {
        :thumb    =&gt; ['100x100#',  :jpg, :quality =&gt; 70],
        :preview  =&gt; ['480x480#',  :jpg, :quality =&gt; 70],
        :large    =&gt; ['600&gt;',      :jpg, :quality =&gt; 70],
        :retina   =&gt; ['1200&gt;',     :jpg, :quality =&gt; 30]
      },
      :convert_options =&gt; {
        :thumb    =&gt; '-set colorspace sRGB -strip',
        :preview  =&gt; '-set colorspace sRGB -strip',
        :large    =&gt; '-set colorspace sRGB -strip',
        :retina   =&gt; '-set colorspace sRGB -strip -sharpen 0x0.5'
      }
  
    validates_attachment :avatar,
      :presence =&gt; true,
      :size =&gt; { :in =&gt; 0..10.megabytes },
      :content_type =&gt; { :content_type =&gt; /^image\/(jpeg|png|gif|tiff)$/ }
  
    validates :name,
      :presence =&gt; true,
      :uniqueness =&gt; true
  end
  </code></pre>
  
  <p>Edit: here is the full trace:</p>
  
  <pre><code>C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/fileutils.rb:252:in `mkdir'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/fileutils.rb:210:in `each'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
  paperclip (5.0.0) lib/paperclip/storage/filesystem.rb:38:in `block in flush_writes'
  paperclip (5.0.0) lib/paperclip/storage/filesystem.rb:37:in `each'
  paperclip (5.0.0) lib/paperclip/storage/filesystem.rb:37:in `flush_writes'
  paperclip (5.0.0) lib/paperclip/attachment.rb:241:in `save'
  paperclip (5.0.0) lib/paperclip/has_attached_file.rb:92:in `block in add_active_record_callbacks'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:396:in `instance_exec'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:396:in `block in make_lambda'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:207:in `call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:207:in `block in halting_and_conditional'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:456:in `call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:456:in `block in call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:456:in `each'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:456:in `call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
  activerecord (5.0.0.1) lib/active_record/callbacks.rb:298:in `create_or_update'
  activerecord (5.0.0.1) lib/active_record/persistence.rb:125:in `save'
  activerecord (5.0.0.1) lib/active_record/validations.rb:44:in `save'
  activerecord (5.0.0.1) lib/active_record/attribute_methods/dirty.rb:22:in `save'
  activerecord (5.0.0.1) lib/active_record/transactions.rb:319:in `block (2 levels) in save'
  activerecord (5.0.0.1) lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
  activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
  activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
  activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
  activerecord (5.0.0.1) lib/active_record/transactions.rb:211:in `transaction'
  activerecord (5.0.0.1) lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
  activerecord (5.0.0.1) lib/active_record/transactions.rb:319:in `block in save'
  activerecord (5.0.0.1) lib/active_record/transactions.rb:334:in `rollback_active_record_state!'
  activerecord (5.0.0.1) lib/active_record/transactions.rb:318:in `save'
  activerecord (5.0.0.1) lib/active_record/suppressor.rb:41:in `save'
  app/controllers/users_controller.rb:30:in `block in create'
  actionpack (5.0.0.1) lib/action_controller/metal/mime_responds.rb:195:in `respond_to'
  app/controllers/users_controller.rb:29:in `create'
  actionpack (5.0.0.1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
  actionpack (5.0.0.1) lib/abstract_controller/base.rb:188:in `process_action'
  actionpack (5.0.0.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
  actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:126:in `call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:126:in `call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:455:in `call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:455:in `call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
  actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (5.0.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action'
  actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
  activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (5.0.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
  activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `instrument'
  actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (5.0.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
  activerecord (5.0.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (5.0.0.1) lib/abstract_controller/base.rb:126:in `process'
  actionview (5.0.0.1) lib/action_view/rendering.rb:30:in `process'
  actionpack (5.0.0.1) lib/action_controller/metal.rb:190:in `dispatch'
  actionpack (5.0.0.1) lib/action_controller/metal.rb:262:in `dispatch'
  actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
  actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
  actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
  actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `each'
  actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
  actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
  rack (2.0.1) lib/rack/etag.rb:25:in `call'
  rack (2.0.1) lib/rack/conditional_get.rb:38:in `call'
  rack (2.0.1) lib/rack/head.rb:12:in `call'
  rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
  rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
  activerecord (5.0.0.1) lib/active_record/migration.rb:552:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
  activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
  railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
  railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
  activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
  activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
  railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
  rack (2.0.1) lib/rack/method_override.rb:22:in `call'
  rack (2.0.1) lib/rack/runtime.rb:22:in `call'
  activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
  actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
  rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
  railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
  rack (2.0.1) lib/rack/handler/webrick.rb:86:in `service'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
  </code></pre>