title: #<Faraday::ConnectionFailed> Connection refused - connect(2)
body: <p>I am receiving the message <code>#&lt;Faraday::ConnectionFailed&gt; Connection refused - connect(2)</code> after using checkboxes to select items in <code>users/edit.html.erb</code> and pressed save.  The items I selected are in an array called <code>amenities_list</code>. These items are booleans. After trying to save the changes I received <code>#&lt;Faraday::ConnectionFailed&gt;</code>.</p>
  
  <p>users/edit.html.erb</p>
  
  <pre><code>&lt;div class="tab-content group"&gt;
  
    &lt;% amenities_list = User.amenities_list %&gt;
  
    &lt;ul&gt;
      &lt;% @user.boolean_array_from_amenities_integer.each_with_index do |amenity_available,index| %&gt;
        &lt;% if amenity_available %&gt;
          &lt;li class="available-amenity"&gt;
        &lt;% else %&gt;
          &lt;li class="unavailable-amenity"&gt;
        &lt;% end %&gt;
            &lt;%= amenities_list[index] %&gt;
          &lt;/li&gt;
      &lt;% end %&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>users_controller.rb</p>
  
  <pre><code>  def new
      @user = User.new
    end
  
    def create
      @user = User.new(params[:user])
      @user.id = current_user.id
      @user.set_amenities_from_options_list!(params[:user_amenities_indicies])
      if @user.save
        flash[:success] = "Thank you for signing up! A confirmation email has been sent to your inbox"
        redirect_to users_path
      else
        render :new
      end
    end
  
    def edit
      @user.id = current_user.id
      @user.set_amenities_from_options_list!(params[:user_amenities_indicies])
    end
  </code></pre>
  
  <p>user.rb</p>
  
  <pre><code>  def self.amenities_list
      ["Smoking Allowed",
       "Pets Allowed",
       "TV",
       "Cable TV",
       "Internet",
       "Wireless Internet",
       "Air Conditioning",
       "Heating",
       "Elevator in Building",
       "Handicap Accessible",
       "Pool",
       "Kitchen",
       "Free parking on premise",
       "Doorman",
       "Gym",
       "Hot Tub",
       "Indoor Fireplace",
       "Buzzer/Wireless Intercom",
       "Breakfast",
       "Family/Kid Friendly",
       "Suitable for Events",
       "Washer",
       "Dryer"]
    end
  
    def self.integer_from_options_list(options_list)
      # convert options list given by radio buttons into one-hot integer
      amenities = 0;
      if options_list
        options_list.each do |option|
          amenities += 2 ** option.to_i
        end
    end
  
      amenities
    end
  
     def self.find_with_filters(filters)
      filtered_users = User
          if filters[:amenities]
            amenities = User.integer_from_options_list(filters[:amenities])
            filtered_users = filtered_users.where("amenities &amp; ? = ?", amenities, amenities)
          end
      end
  
  
   def set_amenities_from_options_list!(options_list)
      self.amenities = User.integer_from_options_list(options_list)
    end
  
      def boolean_array_from_amenities_integer
      [].tap do |amenities_list|
        User.amenities_list.length.times do |order|
          amenities_list &lt;&lt; (self.amenities &amp; 2 ** order &gt; 0)
          end
        end
      end
  
  end
  </code></pre>
  
  <p>gemfile.lock </p>
  
  <pre><code>GEM
    remote: https://rubygems.org/
    specs:
      actionmailer (4.0.3)
        actionpack (= 4.0.3)
        mail (~&gt; 2.5.4)
      actionpack (4.0.3)
        activesupport (= 4.0.3)
        builder (~&gt; 3.1.0)
        erubis (~&gt; 2.7.0)
        rack (~&gt; 1.5.2)
        rack-test (~&gt; 0.6.2)
      activemodel (4.0.3)
        activesupport (= 4.0.3)
        builder (~&gt; 3.1.0)
      activerecord (4.0.3)
        activemodel (= 4.0.3)
        activerecord-deprecated_finders (~&gt; 1.0.2)
        activesupport (= 4.0.3)
        arel (~&gt; 4.0.0)
      activerecord-deprecated_finders (1.0.3)
      activesupport (4.0.3)
        i18n (~&gt; 0.6, &gt;= 0.6.4)
        minitest (~&gt; 4.2)
        multi_json (~&gt; 1.3)
        thread_safe (~&gt; 0.1)
        tzinfo (~&gt; 0.3.37)
      arel (4.0.2)
      atomic (1.1.16)
      bcrypt (3.1.7)
      bcrypt-ruby (3.1.5)
        bcrypt (&gt;= 3.1.3)
      bootstrap-sass (3.1.1.0)
        sass (~&gt; 3.2)
      builder (3.1.4)
      capybara (2.1.0)
        mime-types (&gt;= 1.16)
        nokogiri (&gt;= 1.3.3)
        rack (&gt;= 1.0.0)
        rack-test (&gt;= 0.5.4)
        xpath (~&gt; 2.0)
      carrierwave (0.10.0)
        activemodel (&gt;= 3.2.0)
        activesupport (&gt;= 3.2.0)
        json (&gt;= 1.7)
        mime-types (&gt;= 1.16)
      childprocess (0.5.1)
        ffi (~&gt; 1.0, &gt;= 1.0.11)
      coderay (1.1.0)
      coffee-rails (4.0.1)
        coffee-script (&gt;= 2.2.0)
        railties (&gt;= 4.0.0, &lt; 5.0)
      coffee-script (2.2.0)
        coffee-script-source
        execjs
      coffee-script-source (1.7.0)
      columnize (0.3.6)
      debugger (1.6.6)
        columnize (&gt;= 0.3.1)
        debugger-linecache (~&gt; 1.2.0)
        debugger-ruby_core_source (~&gt; 1.3.2)
      debugger-linecache (1.2.0)
      debugger-ruby_core_source (1.3.2)
      diff-lcs (1.2.5)
      elasticsearch (1.0.2)
        elasticsearch-api (= 1.0.2)
        elasticsearch-transport (= 1.0.2)
      elasticsearch-api (1.0.2)
        multi_json
      elasticsearch-model (0.1.4)
        activesupport (&gt; 3)
        elasticsearch (&gt; 0.4)
        hashie
      elasticsearch-transport (1.0.2)
        faraday
        multi_json
      erubis (2.7.0)
      execjs (2.0.2)
      factory_girl (4.2.0)
        activesupport (&gt;= 3.0.0)
      factory_girl_rails (4.2.1)
        factory_girl (~&gt; 4.2.0)
        railties (&gt;= 3.0.0)
      faker (1.3.0)
        i18n (~&gt; 0.5)
      faraday (0.9.0)
        multipart-post (&gt;= 1.2, &lt; 3)
      ffi (1.9.3)
      figaro (0.7.0)
        bundler (~&gt; 1.0)
        rails (&gt;= 3, &lt; 5)
      geocoder (1.1.9)
      hashie (3.0.0)
      hike (1.2.3)
      i18n (0.6.9)
      jbuilder (1.5.3)
        activesupport (&gt;= 3.0.0)
        multi_json (&gt;= 1.2.0)
      jquery-rails (3.1.0)
        railties (&gt;= 3.0, &lt; 5.0)
        thor (&gt;= 0.14, &lt; 2.0)
      jquery-ui-rails (4.2.0)
        railties (&gt;= 3.2.16)
      json (1.8.1)
      jwt (0.1.11)
        multi_json (&gt;= 1.5)
      mail (2.5.4)
        mime-types (~&gt; 1.16)
        treetop (~&gt; 1.4.8)
      method_source (0.8.2)
      mime-types (1.25.1)
      mini_magick (3.7.0)
        subexec (~&gt; 0.2.1)
      mini_portile (0.5.2)
      minitest (4.7.5)
      multi_json (1.9.0)
      multi_xml (0.5.5)
      multipart-post (2.0.0)
      nokogiri (1.6.1)
        mini_portile (~&gt; 0.5.0)
      oauth (0.4.7)
      oauth2 (0.9.3)
        faraday (&gt;= 0.8, &lt; 0.10)
        jwt (~&gt; 0.1.8)
        multi_json (~&gt; 1.3)
        multi_xml (~&gt; 0.5)
        rack (~&gt; 1.2)
      pg (0.17.1)
      polyglot (0.3.4)
      pry (0.9.12.6)
        coderay (~&gt; 1.0)
        method_source (~&gt; 0.8)
        slop (~&gt; 3.4)
      pry-debugger (0.2.2)
        debugger (~&gt; 1.3)
        pry (~&gt; 0.9.10)
      quiet_assets (1.0.2)
        railties (&gt;= 3.1, &lt; 5.0)
      rack (1.5.2)
      rack-test (0.6.2)
        rack (&gt;= 1.0)
      rails (4.0.3)
        actionmailer (= 4.0.3)
        actionpack (= 4.0.3)
        activerecord (= 4.0.3)
        activesupport (= 4.0.3)
        bundler (&gt;= 1.3.0, &lt; 2.0)
        railties (= 4.0.3)
        sprockets-rails (~&gt; 2.0.0)
      rails_12factor (0.0.2)
        rails_serve_static_assets
        rails_stdout_logging
      rails_serve_static_assets (0.0.2)
      rails_stdout_logging (0.0.3)
      railties (4.0.3)
        actionpack (= 4.0.3)
        activesupport (= 4.0.3)
        rake (&gt;= 0.8.7)
        thor (&gt;= 0.18.1, &lt; 2.0)
      rake (10.1.1)
      rdoc (4.1.1)
        json (~&gt; 1.4)
      rspec-core (2.13.1)
      rspec-expectations (2.13.0)
        diff-lcs (&gt;= 1.1.3, &lt; 2.0)
      rspec-mocks (2.13.1)
      rspec-rails (2.13.1)
        actionpack (&gt;= 3.0)
        activesupport (&gt;= 3.0)
        railties (&gt;= 3.0)
        rspec-core (~&gt; 2.13.0)
        rspec-expectations (~&gt; 2.13.0)
        rspec-mocks (~&gt; 2.13.0)
      rubyzip (0.9.9)
      sass (3.2.15)
      sass-rails (4.0.2)
        railties (&gt;= 4.0.0, &lt; 5.0)
        sass (~&gt; 3.2.0)
        sprockets (~&gt; 2.8, &lt;= 2.11.0)
        sprockets-rails (~&gt; 2.0.0)
      sdoc (0.4.0)
        json (~&gt; 1.8)
        rdoc (~&gt; 4.0, &lt; 5.0)
      selenium-webdriver (2.35.1)
        childprocess (&gt;= 0.2.5)
        multi_json (~&gt; 1.0)
        rubyzip (&lt; 1.0.0)
        websocket (~&gt; 1.0.4)
      simple_form (3.0.1)
        actionpack (&gt;= 4.0.0, &lt; 4.1)
        activemodel (&gt;= 4.0.0, &lt; 4.1)
      slop (3.5.0)
      sorcery (0.8.5)
        bcrypt-ruby (&gt;= 3.0)
        oauth (~&gt; 0.4.4)
        oauth2 (&gt;= 0.8.0, &lt; 1.0.0)
      sprockets (2.11.0)
        hike (~&gt; 1.2)
        multi_json (~&gt; 1.0)
        rack (~&gt; 1.0)
        tilt (~&gt; 1.1, != 1.3.0)
      sprockets-rails (2.0.1)
        actionpack (&gt;= 3.0)
        activesupport (&gt;= 3.0)
        sprockets (~&gt; 2.8)
      state_machine (1.2.0)
      subexec (0.2.3)
      thor (0.18.1)
      thread_safe (0.2.0)
        atomic (&gt;= 1.1.7, &lt; 2)
      tilt (1.4.1)
      treetop (1.4.15)
        polyglot
        polyglot (&gt;= 0.3.1)
      tzinfo (0.3.39)
      uglifier (2.5.0)
        execjs (&gt;= 0.3.0)
        json (&gt;= 1.8.0)
      websocket (1.0.7)
      xpath (2.0.0)
        nokogiri (~&gt; 1.3)
  
  PLATFORMS
    ruby
  
  DEPENDENCIES
    bootstrap-sass (~&gt; 3.1.1)
    capybara (= 2.1.0)
    carrierwave
    coffee-rails (~&gt; 4.0.0)
    elasticsearch-model
    factory_girl_rails (= 4.2.1)
    faker
    figaro
    geocoder
    jbuilder (~&gt; 1.2)
    jquery-rails
    jquery-ui-rails
    mini_magick
    pg
    pry-debugger
    quiet_assets
    rails (= 4.0.3)
    rails_12factor
    rspec-rails (= 2.13.1)
    sass-rails (~&gt; 4.0.0)
    sdoc
    selenium-webdriver (= 2.35.1)
    simple_form
    sorcery
    state_machine
    uglifier (&gt;= 1.3.0)
  </code></pre>