201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
# File 'app/models/base_new.rb', line 201
def inheritable_schema(&blk)
if blk
self.schema_builders << blk
if @schema.nil?
row_proc = dataset.row_proc
set_schema(implicit_table_name) do
primary_key :id, :type=>Integer, :unsigned=>true
end
dataset.row_proc = row_proc if row_proc.is_a?(Proc)
end
builders = []
c = self
begin
builders << c.schema_builders if c.respond_to?(:schema_builders)
end while (c = c.superclass) < InheritableSchema
builders = builders.reverse.flatten
builders.delete(nil)
builders.each { |blk|
@schema.instance_eval(&blk)
}
end
end
|