Skip to content

Instantly share code, notes, and snippets.

@jlindley
Created June 12, 2009 18:50
Show Gist options
  • Save jlindley/128834 to your computer and use it in GitHub Desktop.
Save jlindley/128834 to your computer and use it in GitHub Desktop.
june:dev> t = Tag.new
=> #<Tag id: nil, created_at: nil, updated_at: nil>
june:dev> s = Student.new
=> #<Student id: nil, created_at: nil, updated_at: nil>
june:dev> s.tags << t
=> [#<Tag id: nil, created_at: nil, updated_at: nil>]
june:dev> s.save
Student Create (0.5ms) INSERT INTO "students" ("updated_at", "created_at") VALUES('2009-06-12 18:46:57', '2009-06-12 18:46:57')
Tag Create (0.1ms) INSERT INTO "tags" ("updated_at", "created_at") VALUES('2009-06-12 18:46:57', '2009-06-12 18:46:57')
Tagging Create (0.1ms) INSERT INTO "taggings" ("updated_at", "tag_id", "taggable_type", "taggable_id", "created_at") VALUES('2009-06-12 18:46:57', 4, 'Student', 4, '2009-06-12 18:46:57')
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment