TheBreeze / shadow
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
shadow / TODO
| cc528304 » | TheBreeze | 2008-05-02 | 1 | TODO | |
| 2 | ==== | ||||
| 3 | |||||
| 4 | - RSpec test coverage (currently only tested in application originally written for) | ||||
| 5 | |||||
| 6 | - Need to define create_attribute_shadow_table and create_association_shadow_table, which will generate a migration for you. | ||||
| 7 | Usage example: | ||||
| 8 | Vacation.create_attribute_shadow_table # options include :attachments => [:user, ...] <- creates user_id | ||||
| 9 | # Resulting table: vacation_attribute_shadows | ||||
| 10 | |||||
| 11 | Vacation.create_association_shadow_table # options include :attachments => [:user, ...] <- creates user_id | ||||
| 12 | # Resulting table: vacation_association_shadows | ||||
| 13 | |||||
| 14 | # And (already defined) | ||||
| 15 | Vacation.create_shadow_tables # subsequently calls create_shadow_attributes_table and create_shadow_associations_table | ||||
| 16 | |||||
| 17 | # This should generate: | ||||
| 18 | class CreateVacationShadowTables < ActiveRecord::Migration | ||||
| 19 | def self.up | ||||
| 20 | create_table :vacation_attribute_shadows do |t| | ||||
| 21 | t.text :updated_attributes | ||||
| 22 | t.integer :version, :vacation_id, :user_id | ||||
| 23 | |||||
| 24 | t.timestamps | ||||
| 25 | end | ||||
| 26 | |||||
| 27 | create_table :vacation_association_shadows do |t| | ||||
| 28 | t.string :association, :action | ||||
| 29 | t.integer :record_id, :record_version, :vacation_id, :user_id | ||||
| 30 | |||||
| 31 | t.timestamps | ||||
| 32 | end | ||||
| 33 | end | ||||
| 34 | |||||
| 35 | def self.down | ||||
| 36 | drop_table :vacation_attribute_shadows | ||||
| 37 | drop_table :vacation_association_shadows | ||||
| 38 | end | ||||
| 39 | end | ||||
| 40 | |||||
