active-list 4.1.6 → 4.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.1.6
1
+ 4.1.7
@@ -81,6 +81,10 @@ module ActiveList
81
81
  datum = "(#{datum}.nil? ? '' : ::I18n.translate('countries.'+#{datum}))"
82
82
  elsif @name==:language and self.datatype == :string and self.limit <= 8
83
83
  datum = "(#{datum}.nil? ? '' : ::I18n.translate('languages.'+#{datum}))"
84
+ elsif self.table.model.respond_to?(@name) and !@options[:through]
85
+ if self.table.model.send(@name).respond_to?(:values)
86
+ datum = "(#{datum}.nil? ? '' : #{datum}.text)"
87
+ end
84
88
  end
85
89
  return datum
86
90
  end
@@ -90,6 +94,15 @@ module ActiveList
90
94
  @options[:datatype] || (@column ? @column.type : nil)
91
95
  end
92
96
 
97
+
98
+ def enumerize?
99
+ if self.table.model.respond_to?(@name) and !@options[:through]
100
+ if self.table.model.send(@name).respond_to?(:values)
101
+ return true
102
+ end
103
+ end
104
+ return false
105
+ end
93
106
 
94
107
  def numeric?
95
108
  [:decimal, :integer, :float, :numeric].include? self.datatype
@@ -117,6 +117,8 @@ module ActiveList
117
117
  datum = "(#{datum}.nil? ? '' : ::I18n.localize(#{datum}, :currency => #{currency}))"
118
118
  elsif column.datatype == :decimal
119
119
  datum = "(#{datum}.nil? ? '' : ::I18n.localize(#{datum}))"
120
+ elsif column.enumerize?
121
+ datum = "(#{datum}.nil? ? '' : #{datum}.text)"
120
122
  end
121
123
  if column.options[:url].is_a?(TrueClass) and nature==:body
122
124
  datum = "(#{datum}.blank? ? '' : link_to(#{datum}, {:controller=>:#{column.class_name.underscore.pluralize}, :action=>:show, :id=>#{column.record_expr(record)+'.id'}}))"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: active-list
3
3
  version: !ruby/object:Gem::Version
4
4
  version: !binary |-
5
- NC4xLjY=
5
+ NC4xLjc=
6
6
  prerelease:
7
7
  platform: ruby
8
8
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-31 00:00:00.000000000 Z
13
+ date: 2013-01-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails