title: ActiveResource model is not getting initialized
body: <p>I am looking at using ActiveResource but is now facing a problem that I am unable to figure out myself (was searching the net for a couple of days for the solution by now).</p>
  
  <p>So I have an authentication app sitting at <code>http://localhost:80</code> and a client on port :85</p>
  
  <h2>In my auth app</h2>
  
  <p>I have a User model with its controller which follows REST architecture and is set to respond to xml calls.</p>
  
  <p>Here is what I have in my auth app:</p>
  
  <p><em>models/User.rb</em></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  end
  </code></pre>
  
  <p>*controllers/users_controller.rb*</p>
  
  <pre><code>class UsersController &lt; ApplicationController
  respond_to :html, :xml, :js
  
  def index
      @users = User.find :all
      respond_with @users
  end
  
  def show
      @user = User.find(params[:id])
      respond_with @user
  end
  .
  .
  .
  end
  </code></pre>
  
  <h2>In a client application</h2>
  
  <p>I have a class extending from active resource as follows:</p>
  
  <p><em>models/user.rb</em></p>
  
  <pre><code>class User &lt; ActiveResource::Base
      self.site = "http://localhost:80"
  end
  </code></pre>
  
  <p>Here is how I am trying to use it:
  *controllers/sessions_controller.rb*</p>
  
  <pre><code>class SessionController &lt; ApplicationController
  
    def home
      @user = User.find(:all)
    end
  end
  </code></pre>
  
  <p>what could go wrong, right?..</p>
  
  <p>But then I am getting the following error:</p>
  
  <blockquote>
    <p>Started GET "/" for 127.0.0.1 at 2013-09-02 08:33:44 +1200 Processing<br>
    by SessionsController#home as HTML Completed 500 Internal Server Error<br>
    in 3ms  </p>
    
    <p>NameError (uninitialized constant ActiveResource):<br>
    app/models/user.rb:1:in <code>&lt;top (required)&gt;'<br>
    app/controllers/sessions_controller.rb:4:in</code>home'  </p>
    
    <p>Rendered<br>
    /usr/lib/ruby/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_source.erb<br>
    (1.6ms)   Rendered
    /usr/lib/ruby/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb<br>
    (2.7ms)   Rendered
    /usr/lib/ruby/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb<br>
    (2.2ms)   Rendered
    /usr/lib/ruby/gems/1.9.1/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (37.4ms)  </p>
  </blockquote>
  
  <p>I am using:</p>
  
  <p>ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]<br>
  Rails 4.0.0<br>
  activeresource (4.0.0) gem is installed  </p>
  
  <p><strong>What could I possibly be doing wrong?<br>
  Is it possible that ActiveResource failing to connect to <code>localhost:80</code> and as a result does not get initialized?</strong></p>
  
  <p>EDIT:</p>
  
  <p>done rvm use 2.0.0 so now ruby version is: ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]</p>
  
  <p>EDIT:</p>
  
  <blockquote>
    <p>RubyGems Environment:<br>
      - RUBYGEMS VERSION: 2.0.7<br>
      - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i686-linux]<br>
      - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1<br>
      - RUBY EXECUTABLE: /usr/bin/ruby1.9.1<br>
      - EXECUTABLE DIRECTORY: /usr/bin<br>
      - RUBYGEMS PLATFORMS:<br>
        - ruby<br>
        - x86-linux<br>
      - GEM PATHS:<br>
         - /usr/lib/ruby/gems/1.9.1<br>
         - /home/dmitry/.gem/ruby/1.9.1<br>
      - GEM CONFIGURATION:<br>
         - :update_sources => true<br>
         - :verbose => true<br>
         - :backtrace => false<br>
         - :bulk_threshold => 1000<br>
      - REMOTE SOURCES:<br>
         - <a href="https://rubygems.org/">https://rubygems.org/</a>  </p>
  </blockquote>