Displaying 1 result from an estimated 1 matches for "db_columns".
Did you mean:
_columns
2006 Sep 27
0
MySQL and Default values
...ime
@default == ''00:00:00'' ? nil : @default
when :text, :string
@default == '''' ? nil : @default
else
@default
end
end
end
end
class Base
class << self
alias db_columns :columns
def columns
db_columns.collect do |c|
c.instance_variable_set ''@default'',
default_for(c.name, c.default)
c
end
end
def default_for(field, cur_default)
cur_default
end
end
end...