Note that there are some explanatory texts on larger screens.

plurals
  1. PONameError: uninitialized constant User::SCREEN_NAME_RANGE
    text
    copied!<p>So according to the tutorial on Railsspace, I am suppose to use the console to understand Active Records. So I do what that things says I should do and this is the result I get. </p> <p>Does anyone know where the problem is? </p> <pre><code> $ rails console </code></pre> <p>Output</p> <pre><code>Loading development environment (Rails 3.0.10) ruby-1.9.2-p290 :001 &gt; user = User.new(:screen_name =&gt; "me", ruby-1.9.2-p290 :002 &gt; :email =&gt; "", ruby-1.9.2-p290 :003 &gt; :password =&gt; "a",) NameError: uninitialized constant User::SCREEN_NAME_RANGE from /Users/dennisbuizert/Sites/gpoff/app/models/user.rb:3:in `&lt;class:User&gt;' from /Users/dennisbuizert/Sites/gpoff/app/models/user.rb:1:in `&lt;top (required)&gt;' from (irb):1 from /Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands/console.rb:44:in `start' from /Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands/console.rb:8:in `start' from /Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands.rb:23:in `&lt;top (required)&gt;' from script/rails:6:in `require' from script/rails:6:in `&lt;main&gt;' </code></pre> <p>User model</p> <pre><code> class User &lt; ActiveRecord::Base validates_uniqueness_of :screen_name, :email validates_length_of :screen_name, :within =&gt; SCREEN_NAME_RANGE validates_length_of :password, :within =&gt; PASSWORD_RANGE validates_length_of :email, :maximum =&gt; EMAIL_MAX_LENGTH validates_presence_of :email # Max &amp; Min length for all fields SCREEN_NAME_MIN_LENGTH = 3 SCREEN_NAME_MAX_LENGTH = 20 PASSWORD_MIN_LENGTH = 8 PASSWORD_MAX_LENGTH = 26 EMAIL_MAX_LENGTH = 50 SCREEN_NAME_RANGE = SCREEN_NAME_MIN_LENGHT..SCREEN_NAME_MAX_LENGTH PASSWORD_RANGE = PASSWORD_MIN_LENGHT..PASSWORD_MAX_LENGTH end </code></pre> <p>I am using SQLite3 rather than MySQL, because I cannot figure out how to replace SQLite3 with mysql and how to get that working.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload