OSDN Git Service

initialize repository
[traxi/force_columns.git] / README.ja
1 ForceColumns
2 ============
3
4 すべてのモデルに強制的にあるカラムを作成する。
5
6 現在のところ以下のものを自動的に追加する。
7
8 * domain_id
9 * created_at
10 * updated_at
11 * created_by_id
12 * updated_by_id
13 * created_in_id
14 * updated_in_id
15 * lock_version
16
17 他には domain_id の更新を自動的に行ったり、filter_by_current_domain という named_scope を自動的に
18 追加する。
19
20
21 Example
22 =======
23
24 特に何もしなくても上記のカラムは追加される。
25
26 追加したくないカラムがある場合:
27
28   class CreateSamples < ActiveRecord::Migration
29     def self.up
30       create_table :samples, :domain_id => false do
31         t.string :name
32       end
33     end
34     def self.down
35       drop_table :samples
36     end
37   end
38
39 set_table_name を使用する場合:
40
41   class DummySample < ActiveRecord::Base
42     set_table_name 'samples'
43     force_domain
44   end
45
46