Skip to content

Instantly share code, notes, and snippets.

@augustovictor
Created January 7, 2013 06:20
Show Gist options
  • Save augustovictor/4472905 to your computer and use it in GitHub Desktop.
Save augustovictor/4472905 to your computer and use it in GitHub Desktop.
p = u.projects.new
=> #<Project id: nil, name: nil, description: nil, created_at: nil, updated_at: nil, user_id: nil>
1.9.2p290 :007 > p.name = 'Project test'
=> "Project test"
1.9.2p290 :008 > p.user_id = u
=> #<User id: 1, email: "victor@gmail.com", encrypted_password: "$2a$10$Ztr8sTf9R5Wuw6YLlcGbmueg8EQX7sFpKTPlUngwrSZa...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 5, current_sign_in_at: "2013-01-02 12:32:17", last_sign_in_at: "2012-12-03 01:53:59", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2012-11-21 14:45:09", updated_at: "2013-01-02 13:45:21", name: "Victor Augusto Pinto costa", login_name: "victoraweb">
1.9.2p290 :009 > p.save
(0.2ms) BEGIN
SQL (0.7ms) INSERT INTO `projects` (`created_at`, `description`, `name`, `updated_at`, `user_id`) VALUES ('2013-01-07 06:20:00', NULL, 'Project Test', '2013-01-07 06:20:00', 1)
(0.6ms) COMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment