title: I'm confused by Model (call 'Model.connection' to establish a connection) message received in console
body: <p>I'd noticed this recently after starting my first Rails 5 app, but up until this point, it wasn't causing an issue I couldn't overcome. </p>
  
  <p>The point that I couldn't overcome came when I tried to write my first Rake task. I continued to get this error:</p>
  
  <pre><code>ruby 2.3.3-p222
  ╳  ad_board categories ◆◆ rake reprocess_images                                                                                                                  
  rake aborted!
  NameError: uninitialized constant Image
  /home/myname/Documents/workspace/ad_board/lib/tasks/reprocess_images.rake:3:in `block in &lt;top (required)&gt;'
  /home/myname/.rvm/gems/ruby-2.3.3@myapp/gems/rake-11.3.0/exe/rake:27:in `&lt;top (required)&gt;'
  /home/myname/.rvm/gems/ruby-2.3.3@myapp/bin/ruby_executable_hooks:15:in `eval'
  /home/myname/.rvm/gems/ruby-2.3.3@myapp/bin/ruby_executable_hooks:15:in `&lt;main&gt;'
  Tasks: TOP =&gt; reprocess_images
  </code></pre>
  
  <p>I assumed I either wrote the rake task incorrectly(could still be the case) or that I had made my model <code>image.rb</code> in this case <code>images.rb</code>, but I had not. </p>
  
  <p>When I went to <code>rails c</code> to see if I could figure out what was going on, after typing in <code>Image</code>, expecting to get back Image's parameters, I instead got back this error message:</p>
  
  <pre><code>[1] pry(main)&gt; Image
  =&gt; Image (call 'Image.connection' to establish a connection)
  </code></pre>
  
  <p>So, I tried a few other things:</p>
  
  <pre><code>[2] pry(main)&gt; Image.connected?
  =&gt; false
  [3] pry(main)&gt; User.connected?
  =&gt; false
  [4] pry(main)&gt; Gallery.connected?
  =&gt; false
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>[1] pry(main)&gt; Image
  =&gt; Image (call 'Image.connection' to establish a connection)
  [2] pry(main)&gt; User
  =&gt; User (call 'User.connection' to establish a connection)
  [3] pry(main)&gt; User.first
    User Load (1.3ms)  SELECT  "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1  [["LIMIT", 1]]
  =&gt; #&lt;User id: 1, email: "user@example.com", created_at: "2017-01-10 21:43:53", updated_at: "2017-01-10 21:43:53", name: "First User", role: "admin", auth_token: nil&gt;
  [4] pry(main)&gt; Image.first
    Image Load (0.9ms)  SELECT  "images".* FROM "images" ORDER BY "images"."id" ASC LIMIT $1  [["LIMIT", 1]]
  =&gt; #&lt;Image:0x0000000595bf00 id: 1, file: "creativity.jpg", user_id: 20, created_at: Tue, 10 Jan 2017 21:43:58 UTC +00:00, updated_at: Tue, 10 Jan 2017 21:43:58 UTC +00:00&gt;
  </code></pre>
  
  <p>I also typed in <code>Image.connection</code>, but all it did, like the above code, was to temporarily make a connection. As soon as I left the console I continued to get the original error message from running my rake task.</p>
  
  <p>I went back into the console and typed <code>Image</code>, and received the message <code>=&gt; Image (call 'Image.connection' to establish a connection)</code></p>
  
  <p>So, the first question, is why does the "connection" break, does not establish or stay on its own? I have not run into this before now, in my limited experience. </p>
  
  <p>The obvious follow-up is, how do I fix the issue and maintain a connection?</p>
  
  <p>Thanks in advance for any insight into this issue you can give me.</p>