Created
October 21, 2008 15:55
-
-
Save fairchild/18334 to your computer and use it in GitHub Desktop.
sequel versioning
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
class Ticket < Sequel::Model | |
set_schema do | |
foreign_key :ticket_version_id, :table => :ticket_version | |
end | |
is(:versioned_fact, {:dimensions => [TicketVersion]}) | |
one_to_many :ticket_versions | |
end | |
class TicketVersion < Sequel::Model | |
set_schema do | |
foreign_key :ticket_id, :table => :tickets | |
end | |
is :versioned_object | |
many_to_one :ticket | |
end | |
tic = Ticket.create(:name=>"version 1") | |
tic.name = "version 2" | |
tic.save | |
puts tic.current_ticket_version # should =2 | |
puts tic.get_version(1).name #should = name. This methoud is not implemented. How woudl I get this fucntionality? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment