Skip to content

Instantly share code, notes, and snippets.

@fairchild
Created October 21, 2008 15:55
Show Gist options
  • Save fairchild/18334 to your computer and use it in GitHub Desktop.
Save fairchild/18334 to your computer and use it in GitHub Desktop.
sequel versioning
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