title: RoR - NameError: uninitialized constant Info / NameError: undefined local variable or method 'info' for main:Object
body: <p>After doing four RoR tutorials, I am more confused, as they never explain <em>why</em> things are coded a certain way and in what order without a why, all I'm learning is how - which I don't think makes a good coder.  This morning I decided to build a small app that allowed a user to input credit card info - the credit card number, credit card code, and address in a textbox (this part I haven't gotten to yet).  According to the tutorials, they tend to begin on the database end of things.  My steps so far:</p>
  
  <p>Step 1.  Created the application.</p>
  
  <p>Step 2.  Executed "rails generate model info"</p>
  
  <p>Step 3.  In the db\migrate folder this created a file with a format of timestamp_create_infos.  I inputed the code as follows in the file:</p>
  
  <pre><code>class CreateInfos &lt; ActiveRecord::Migration
    def change
      create_table :infos do |t|
        t.integer :ccnumber
        t.integer :cccode
        t.text :address
        t.timestamps
      end
    end
  end
  </code></pre>
  
  <p>According the the various articles, this should build a table with the values I listed above and their various types in sqllite.  I think in analogies, so I view like creating a database in SQLServer (correct me if this assumption is wrong):</p>
  
  <pre><code>CREATE TABLE info (
    ccnumber BIGINT,
    cccode INT,
    address VARCHAR(50)
  )
  </code></pre>
  
  <p>Step 4: In the app\models folder, I edited the file "info.rb" as the following:</p>
  
  <pre><code>class Info &lt; ActiveRecord::Base
    validates :ccnumber, :presence =&gt; true, :length =&gt; {minimum:16}
    validates :cccode, :presence =&gt; true, :length =&gt; {minimum:3}
    validates :address, :presence =&gt; true
  end
  </code></pre>
  
  <p>At this point, most tutorials (which usually build blogs or Twitter-clones) will "test" things by executing IRB.  What they'll usually do, for instance, is try to create a new value.  However, when I do so using either of the two below methods:</p>
  
  <pre><code>c = Info.new
  c = info.new
  </code></pre>
  
  <p>I receive this error:</p>
  
  <pre><code>NameError: uninitialized constant Info / NameError: undefined local variable or method 'info' for main:Object
  </code></pre>
  
  <p>Perhaps the code is wrong, or there is another step involved, but I'm following an identical pattern to these tutorials - which I why I, after completing several of them, I tried to build something new on my own, as their methodology lacks the why.  </p>
  
  <p>For instance (and correct me if I'm wrong), when building new applications, should rails generate model info be run first?  Or, will that create other errors later on.  Also, should the database be built second (I would assume so, as any application referencing a database will need a database in order to reference it) - I would assume here that my database I built in the migrate folder isn't incorrect, but something else is that's not calling those values?  </p>
  
  <p>Finally, I tried creating a "blank" value in this example to receive an error related to the validation (obviously the new lacks values, which it will need).  Even if I try to initialize a new with the correct values (in this case, minimum and in existence), it still these errors (though they differ if I try c = Info.new vs. c = info.new).</p>