Created
January 18, 2009 21:29
-
-
Save foca/48777 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Integrity | |
class Commit | |
include DataMapper::Resource | |
property :id, Integer, :serial => true | |
property :identifier, String, :nullable => false | |
property :message, String, :nullable => false, :length => 255 | |
property :author, String, :nullable => false, :length => 255 | |
property :committed_at, DateTime, :nullable => false | |
belongs_to :project, :class_name => "Integrity::Project" | |
end | |
end |
This file contains hidden or 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
(rdb:1) p self.commits | |
[#<Integrity::Commit id=7 identifier="4fdc7c15ab0829c55c2ef92b6878d61f637194cf" message="Alburn gympie osmosis uninterestedness mallowwort" author="microorganismal queanish <[email protected]>" committed_at=#<DateTime: 1178487059/480,-1/12,2299161> project_id=8>, #<Integrity::Commit id=8 identifier="a5b8106f94d4622a974ea7bdafad1affb3de6ce2" message="Perlid muddleheaded maladventure scaphocephalic boomage crinite lignin uitotan" author="Ficula unhappily <[email protected]>" committed_at=#<DateTime: 441932647/180,-1/12,2299161> project_id=8>] | |
(rdb:1) p self.commits.map {|c| c.committed_at.to_s } | |
["2009-12-15T18:57:00-02:00", "2009-12-15T18:56:00-02:00"] | |
(rdb:1) p self.commits(:order => [:committed_at.desc]) | |
[] | |
This file contains hidden or 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 Integrity | |
class Project | |
include DataMapper::Resource | |
property :id, Integer, :serial => true | |
property :name, String, :nullable => false | |
property :permalink, String | |
property :uri, URI, :nullable => false, :length => 255 | |
property :branch, String, :nullable => false, :default => "master" | |
property :command, String, :nullable => false, :length => 255, :default => "rake" | |
property :public, Boolean, :default => true | |
property :building, Boolean, :default => false | |
property :created_at, DateTime | |
property :updated_at, DateTime | |
has n, :commits, :class_name => "Integrity::Commit" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment