lib/yap/column_mapper.rb in yap-1.4.0 vs lib/yap/column_mapper.rb in yap-1.4.2
- old
+ new
@@ -1,12 +1,14 @@
module ColumnMapper
- private
-
def map_column(name)
- column_names.include?(name) ? name : if respond_to? :map_name_to_column
+ actual_column = name if column_names.include?(name)
+
+ column_alias = if respond_to? :map_name_to_column
map_name_to_column(name)
- else
- warn "#{self.name} does not implement map_name_to_column. If you do not need column mapping set disable_warnings=true" unless Yap::DEFAULTS.disable_warnings
- nil
+ elsif actual_column.nil? && !Yap::DEFAULTS.disable_warnings
+ warn "#{self.name} does not implement map_name_to_column. If you do not need column mapping set " \
+ 'disable_warnings=true'
end
+
+ column_alias || actual_column
end
-end
\ No newline at end of file
+end