File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ class << self
47
47
48
48
self . primary_key ||= :id
49
49
50
+ def column_for_attribute ( name )
51
+ self . class . fields [ name . to_sym ]
52
+ end
53
+
50
54
end
51
55
52
56
module ClassMethods
@@ -92,12 +96,12 @@ module ClassMethods
92
96
93
97
# Columns
94
98
95
- # def content_columns
96
- # # cannot cache this, since changes in time (while defining fields)
97
- # fields.map(&:second).reject do |f|
98
- # f.name =~ /(^_|^(created|updated)_at)/ or Mongoid::Fields::ForeignKey === f
99
- # end
100
- # end
99
+ def content_columns
100
+ # cannot cache this, since changes in time (while defining fields)
101
+ fields . map ( &:second ) . reject do |f |
102
+ f . name =~ /(^_|^(created|updated)_at)/ or Mongoid ::Fields ::ForeignKey === f
103
+ end
104
+ end
101
105
102
106
# def columns
103
107
# @columns ||= fields.map(&:second).map{ |c| ColumnWrapper.new(c) }
You can’t perform that action at this time.
0 commit comments