Created
June 5, 2010 03:01
-
-
Save zombor/426251 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
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 |
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
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 |
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
#<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