$ rails console --sandbox
Loading development environment in sandbox (Rails 3.1.3)
Any modifications you make will be rolled back on exit
irb(main):001:0> User.new
=> #<User id: nil, name: nil, email: nil, created_at: nil, updated_at: 
nil>
irb(main):002:0> User.first
  ←[1m←[36mUser Load (0.0ms)←[0m  ←[1mSELECT "users".* FROM "users" 
LIMIT 1←[0m
=> nil
irb(main):003:0> user = User.new(:name => "Michael Hartl", :email => 
"[email protected]")
=> #<User id: nil, name: "Michael Hartl", email: "[email protected]", 
created_at: nil, updated_at: nil>
irb(main):004:0> user.save
  ←[1m←[35m (0.0ms)←[0m  SAVEPOINT active_record_1
  ←[1m←[36m (0.0ms)←[0m  ←[1mSELECT 1 FROM "users" WHERE 
LOWER("users"."email") = LOWER('[email protected]') LIMIT 1←[0m
  ←[1m←[35mSQL (15.5ms)←[0m  INSERT INTO "users" ("created_at", "email", 
"name", "updated_at") VALUES (?, ?, ?, ?)  [["created_at", Tue, 29 Nov 
2011 12:28:21 UTC +00:00], ["email", "[email protected]
"], ["name", "Michael Hartl"], ["updated_at", Tue, 29 Nov 2011 12:28:21 
UTC +00:00]]
  ←[1m←[36m (0.0ms)←[0m  ←[1mRELEASE SAVEPOINT active_record_1←[0m
=> true
irb(main):005:0> User.first
  ←[1m←[35mUser Load (0.0ms)←[0m  SELECT "users".* FROM "users" LIMIT 1
=> #<User id: 1, name: "Michael Hartl", email: "[email protected]", 
created_at: "2011-11-29 12:28:21", updated_at: "2011-11-29 12:28:21">




users_controller.rb:

class UsersController < ApplicationController

  def show
    @user = User.find(params[:id])
  end

  def new
    @title = "Sign Up"
  end

end

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to