Variables defined in your script will go out of scope once the file is loaded. If you want to use the variables in console, define them as instance variables or constants
@u = User.where('last_name = ?', 'Spock').first
or
USER = User.where('last_name = ?', 'Spock').first