|
@@ -26,6 +26,23 @@ module CoreExtensions
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+module MethodLogger
|
|
|
+ class Methods
|
|
|
+ @@accessor_methods = {}
|
|
|
+
|
|
|
+ def self.add(klass, meth)
|
|
|
+ @@accessor_methods[klass] ||= []
|
|
|
+ @@accessor_methods[klass] << meth
|
|
|
+ end
|
|
|
+
|
|
|
+ def self.list(klass)
|
|
|
+ @@accessor_methods[klass]
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
|
|
|
|
|
|
module SchildTypeSaver
|
|
@@ -37,6 +54,8 @@ module SchildTypeSaver
|
|
|
def self.included(klass)
|
|
|
klass.columns.each do |column|
|
|
|
name = column.snake_case
|
|
|
+ MethodLogger::Methods.add(klass, name)
|
|
|
+
|
|
|
define_method(name) do |allow_nil=false|
|
|
|
ret = public_send(column)
|
|
|
if allow_nil || ret
|