Sha256: b0d7eee5e3902215d6491fe49c45d7b252976fccaa93c2dbc8bac54971c1b14d

Contents?: true

Size: 781 Bytes

Versions: 1

Compression:

Stored size: 781 Bytes

Contents

require "uri"

require "not_relational/domain_model.rb"
class Message < NotRelational::DomainModel
    
  property :id,:string,:is_primary_key=>true
  property :title  , :string
  property :content  , :clob
  property :created_time_utc , :date
  property :from_user_name , :string
  property :to_user_name  , :string
 
  
  belongs_to :User,:from_user_name,:sender
  belongs_to :User,:to_user_name,:recipient
   def url
          return "/messages/#{self.id}"
  end
   def Message.recent(how_many=24)
      Message.find(:all,:limit=>how_many,:order_by =>:created_time_utc, :order=>:descending)
  end
  
    def Message.inbox(login,how_many=32)
      Message.find(:all,:limit=>how_many,:order_by =>:created_time_utc, :order=>:descending,:params=>{:to_user_name=>login})
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudwow-not_relational-0.1.0 test/models/message.rb