Skip to content

Instantly share code, notes, and snippets.

@zombor
Created June 5, 2010 03:01
Show Gist options
  • Save zombor/426251 to your computer and use it in GitHub Desktop.
Save zombor/426251 to your computer and use it in GitHub Desktop.
module Picombo
module Models
class Feed_Post < Picombo::Model
storage_names[:default] = 'feed_posts'
property :id, Serial, :key => true
property :content, String
belongs_to :user, :model => 'Picombo::Models::User'
end
end
end
feed = []
Picombo::Models::Feed_Post.all.each do |post|
puts post.inspect
puts post.user.inspect
feed << {
:content => post.content,
#:username => post.user.username
}
end
#<Picombo::Models::Feed_Post @id=1 @content="Testing">
nil
#<Picombo::Models::Feed_Post @id=2 @content="Foobar" @user_id=nil>
nil
#<Picombo::Models::Feed_Post @id=1 @content="Testing" @user_id=1>
nil
#<Picombo::Models::Feed_Post @id=2 @content="Foobar" @user_id=nil>
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment