Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ruby-1.9.2-p0 :002 > User.where('settings.receive_newsletter' => true).map(&:name)
- => []
- ruby-1.9.2-p0 :003 > u = User.where(:email => /lewy/).first
- => #<User _id: 4e3110bdffd785027a000004, _type: nil, created_at: 2011-07-28 07:33:18 UTC, updated_at: 2011-07-28 07:33:18 UTC, deleted_at: nil, votes_stats: {}, name: "Paweł Lewiński", about: nil, place: nil, language: "pl", comment_counter: nil, registered_through: :facebook, slug: "pawel-lewinski", avatar_filename: nil, panel_last_company_id: nil, api_server_id: nil, campaign_ids: [], email: "lewy313@gmail.com", encrypted_password: "$2a$10$tG1mi9C8raqC.FjF0/ug.uQwkHFla50CXVKBUB8DFYjR0yHwBfYaG", authentication_token: nil, remember_token: "kgBLktoyYdUf40yyW7oi", remember_created_at: 2011-07-28 07:33:18 UTC, reset_password_token: nil, confirmation_token: nil, confirmed_at: 2011-07-28 07:33:18 UTC, confirmation_sent_at: nil, sign_in_count: 1, current_sign_in_at: 2011-07-28 07:33:18 UTC, last_sign_in_at: 2011-07-28 07:33:18 UTC, current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1">
- ruby-1.9.2-p0 :004 > u.settings.update_attributes(:receive_newsletter => true)
- => true
- ruby-1.9.2-p0 :005 > u.reload
- => #<User _id: 4e3110bdffd785027a000004, _type: nil, created_at: 2011-07-28 07:33:18 UTC, updated_at: 2011-07-28 07:33:18 UTC, deleted_at: nil, votes_stats: {}, name: "Paweł Lewiński", about: nil, place: nil, language: "pl", comment_counter: nil, registered_through: :facebook, slug: "pawel-lewinski", avatar_filename: nil, panel_last_company_id: nil, api_server_id: nil, campaign_ids: [], email: "lewy313@gmail.com", encrypted_password: "$2a$10$tG1mi9C8raqC.FjF0/ug.uQwkHFla50CXVKBUB8DFYjR0yHwBfYaG", authentication_token: nil, remember_token: "kgBLktoyYdUf40yyW7oi", remember_created_at: 2011-07-28 07:33:18 UTC, reset_password_token: nil, confirmation_token: nil, confirmed_at: 2011-07-28 07:33:18 UTC, confirmation_sent_at: nil, sign_in_count: 1, current_sign_in_at: 2011-07-28 07:33:18 UTC, last_sign_in_at: 2011-07-28 07:33:18 UTC, current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1">
- ruby-1.9.2-p0 :006 > u.settings.receive_newsletter
- => true
- ruby-1.9.2-p0 :007 > User.where('settings.receive_newsletter' => true).map(&:name)
- => []
- ruby-1.9.2-p0 :008 > User.where('settings.receive_newsletter' => true).count
- => 0
- ruby-1.9.2-p0 :009 > u.settings.receive_newsletter
- => true
- ruby-1.9.2-p0 :010 > u.settings.receive_newsletter = true
- => true
- ruby-1.9.2-p0 :011 > u.settings.save
- => true
- ruby-1.9.2-p0 :012 > u.reload
- => #<User _id: 4e3110bdffd785027a000004, _type: nil, created_at: 2011-07-28 07:33:18 UTC, updated_at: 2011-07-28 07:33:18 UTC, deleted_at: nil, votes_stats: {}, name: "Paweł Lewiński", about: nil, place: nil, language: "pl", comment_counter: nil, registered_through: :facebook, slug: "pawel-lewinski", avatar_filename: nil, panel_last_company_id: nil, api_server_id: nil, campaign_ids: [], email: "lewy313@gmail.com", encrypted_password: "$2a$10$tG1mi9C8raqC.FjF0/ug.uQwkHFla50CXVKBUB8DFYjR0yHwBfYaG", authentication_token: nil, remember_token: "kgBLktoyYdUf40yyW7oi", remember_created_at: 2011-07-28 07:33:18 UTC, reset_password_token: nil, confirmation_token: nil, confirmed_at: 2011-07-28 07:33:18 UTC, confirmation_sent_at: nil, sign_in_count: 1, current_sign_in_at: 2011-07-28 07:33:18 UTC, last_sign_in_at: 2011-07-28 07:33:18 UTC, current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1">
- ruby-1.9.2-p0 :013 > User.where('settings.receive_newsletter' => true).count
- => 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement