This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Streaming Active(62)] > | |
Invalid command. Type help to see a summary of valid commands. | |
[Streaming Active(89)] > show_current | |
Ce soir c'est la petite siréne. | |
[Streaming Active(116)] > show_current | |
@thedeadbaby Nope, I am positive. | |
[Streaming Active(129)] > show_current | |
@scottmccloud @markcrilley Agree. As a reader of manga, the best novels are those that are "written" from the heart, not by the book. | |
[Streaming Active(155)] > show_current | |
ROBERTOS. Yummmmmm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MongoMapper.database = "mongo_test" | |
class FirstDocument | |
include MongoMapper::Document | |
key :message, String | |
many :second_documents | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
include MongoMapper::Document | |
key :first_name, String | |
key :last_name, String | |
key :age, Integer | |
key :born_at, Time | |
key :active, Boolean | |
key :fav_colors, Array | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
person = Person.create({ | |
:first_name => 'John', | |
:last_name => 'Nunemaker', | |
:age => 27, | |
:born_at => Time.mktime(1981, 11, 25, 2, 30), | |
:active => true, | |
:fav_colors => %w(red green blue) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
person.first_name = 'Johnny' | |
person.save | |
person.destroy | |
# or you could do this to destroy | |
Person.destroy(person.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
include MongoMapper::Document | |
key :first_name, String | |
key :last_name, String | |
key :age, Integer | |
key :born_at, Time | |
key :active, Boolean | |
key :fav_colors, Array | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Create a new person instance | |
person = Person.new | |
#Inject two new Address instances | |
#Notice how we don't save the Address instances before injecting them... | |
person.addresses << Address.new(:city => 'South Bend', :state => 'IN') | |
person.addresses << Address.new(:city => 'Chicago', :state => 'IL') | |
#When we save the person object, the addresses are injected into the person record automatically | |
person.save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"last_name"=>"Nunemaker", | |
"age"=>27, | |
"born_at"=>Wed Nov 25 02:30:00 -0600 1981, | |
"fav_colors"=>["red", "green", "blue"], | |
"first_name"=>"John", | |
"active"=>true, | |
"addresses" => [{"city"=>"South Bend", "state"=>"IN"}, {"city"=>"Chicago", "state"=>"IL"}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main)> Person.all(:conditions => {:last_name => 'Nunemaker'}, :order => 'first_name') | |
=> [#<Person last_name: Nunemaker, fav_colors: redgreenblue, born_at: Wed Nov 25 02:30:00 -0600 1981, age: 27, active: true, first_name: John>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):024:0> Person.first(:conditions => {"addresses.city" => "South Bend"}) | |
=> #<Person last_name: Nunemaker, fav_colors: redgreenblue, born_at: Wed Nov 25 02:30:00 -0600 1981, age: 27, active: true, first_name: John> |