Skip to content

Instantly share code, notes, and snippets.

@samanpwbb
Created June 10, 2013 19:47
Show Gist options
  • Save samanpwbb/5751648 to your computer and use it in GitHub Desktop.
Save samanpwbb/5751648 to your computer and use it in GitHub Desktop.
>> User.find_by_display_name('samanbb')
User Load (2.2ms) SELECT "users".* FROM "users" WHERE "users"."display_name" = 'samanbb' LIMIT 1
=> nil
>> User.find_by_display_name('saman')
User Load (3.1ms) SELECT "users".* FROM "users" WHERE "users"."display_name" = 'saman' LIMIT 1
=> #<User email: "samanpwbb@gmail.com", id: 1, pass_crypt: "c3d0633a5ea55ac9f3d4043c94d2b005", creation_time: "2012-10-19 21:26:09", display_name: "saman", data_public: true, description: "", home_lat: nil, home_lon: nil, home_zoom: 3, nearby: 50, pass_salt: "FjTRXGXE", image_file_name: nil, email_valid: false, new_email: nil, creation_ip: "127.0.0.1", languages: "en-US,en", status: "pending", terms_agreed: "2012-10-19 21:26:09", consider_pd: true, openid_url: nil, preferred_editor: nil, terms_seen: true, description_format: "markdown", image_fingerprint: nil, changesets_count: 0, traces_count: 0, diary_entries_count: 0, image_use_gravatar: true>
>> u = User.find_by_display_name('saman')
User Load (3.7ms) SELECT "users".* FROM "users" WHERE "users"."display_name" = 'saman' LIMIT 1
=> #<User email: "samanpwbb@gmail.com", id: 1, pass_crypt: "c3d0633a5ea55ac9f3d4043c94d2b005", creation_time: "2012-10-19 21:26:09", display_name: "saman", data_public: true, description: "", home_lat: nil, home_lon: nil, home_zoom: 3, nearby: 50, pass_salt: "FjTRXGXE", image_file_name: nil, email_valid: false, new_email: nil, creation_ip: "127.0.0.1", languages: "en-US,en", status: "pending", terms_agreed: "2012-10-19 21:26:09", consider_pd: true, openid_url: nil, preferred_editor: nil, terms_seen: true, description_format: "markdown", image_fingerprint: nil, changesets_count: 0, traces_count: 0, diary_entries_count: 0, image_use_gravatar: true>
>> u
=> #<User email: "samanpwbb@gmail.com", id: 1, pass_crypt: "c3d0633a5ea55ac9f3d4043c94d2b005", creation_time: "2012-10-19 21:26:09", display_name: "saman", data_public: true, description: "", home_lat: nil, home_lon: nil, home_zoom: 3, nearby: 50, pass_salt: "FjTRXGXE", image_file_name: nil, email_valid: false, new_email: nil, creation_ip: "127.0.0.1", languages: "en-US,en", status: "pending", terms_agreed: "2012-10-19 21:26:09", consider_pd: true, openid_url: nil, preferred_editor: nil, terms_seen: true, description_format: "markdown", image_fingerprint: nil, changesets_count: 0, traces_count: 0, diary_entries_count: 0, image_use_gravatar: true>
>> u.status = 'active'
=> "active"
>> u.email_valid = true
=> true
>> u.save!
(0.3ms) BEGIN
(1.0ms) UPDATE "users" SET "email_valid" = 't', "status" = 'active' WHERE "users"."id" = 1
Changeset Load (70.2ms) SELECT "changesets".* FROM "changesets" WHERE "changesets"."user_id" = 1 ORDER BY created_at DESC LIMIT 10
Creating scope :public. Overwriting existing method Trace.public.
Trace Load (15.4ms) SELECT "gpx_files".* FROM "gpx_files" WHERE "gpx_files"."user_id" = 1 AND "gpx_files"."visible" = 't' LIMIT 10
DiaryEntry Load (8.2ms) SELECT "diary_entries".* FROM "diary_entries" WHERE "diary_entries"."user_id" = 1 ORDER BY created_at DESC
DiaryComment Load (2.1ms) SELECT "diary_comments".* FROM "diary_comments" WHERE "diary_comments"."user_id" = 1 ORDER BY created_at DESC
(1.2ms) COMMIT
=> true
>> q
NameError: undefined local variable or method `q' for main:Object
from (irb):14
from :0
>> ^C^C
>> quit
quit
^C
>> exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment