Ruby on Rails Tuesday, February 24, 2015

irb(main):001:0> c = Course.new user_id: [1,2], name: "course1"
=> #<Course id: nil, user_id: [1, 2], name: "course1", description: " ",
welcome_note: " ", promotional_text: " ", phone_number: " ",
restaurant_phone_number: " ", created_at: nil, updated_at: nil,
main_image_file_name: nil, main_image_content_type: nil,
main_image_file_size: nil, main_image_updated_at: nil,
restaurant_menu_image_file_name: nil,
restaurant_menu_image_content_type: nil,
restaurant_menu_image_file_size: nil, restaurant_menu_image_updated_at:
nil, line1: " ", line2: " ", city: " ", state: " ", zip: " ", latitude:
0.0, longitude: 0.0>
irb(main):002:0> c.save
(0.2ms) BEGIN
SQL (0.7ms) INSERT INTO "courses" ("created_at", "name",
"updated_at", "user_id") VALUES ($1, $2, $3, $4) RETURNING "id"
[["created_at", "2015-02-24 09:41:57.932835"], ["name", "course1"],
["updated_at", "2015-02-24 09:41:57.932835"], ["user_id", "{1,2}"]]
(0.6ms) COMMIT
=> true
irb(main):003:0> c.valid?
=> true

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/babe3d0b1988d857ae8b6c6cab7f7269%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment