-
-
Save mbijon/88f2946c553aaad39ca74782eef41e4b to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'friendly' | |
Friendly.configure( | |
:adapter => 'mysql', | |
:host => 'localhost', | |
:user => 'root', | |
:password => '', | |
:database => 'friendly_db' | |
) | |
class FreeTweet | |
include Friendly::Document | |
attribute :author, String | |
attribute :content, String | |
indexes :author | |
end | |
Friendly.create_tables! | |
[ | |
["foo", "Me"], | |
["bar", "Me"], | |
["something really smart(er) than foo, bar, baz, ...", "Homer Simpson"] | |
].each do |content, author| | |
FreeTweet.create(:author => author, :content => content) | |
end | |
FreeTweet.all(:author => 'Me').each do |t| | |
puts "#{t.content} - by #{t.author}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment