Sha256: 717186d9bdf9fe7e726b7c0b4f174de5715ad331a567616fe9ff227edef22585
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
#-- # Copyright (c) 2010-2014 Peter Horn & Florian Thomas, Provideal GmbH # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ class Tabulatr::Renderer::Association < Tabulatr::Renderer::Column def human_name header || klass.reflect_on_association(table_name.to_sym).klass.model_name.human + ' ' + klass.reflect_on_association(table_name.to_sym).klass.human_attribute_name(name) end def coltype() 'association' end def column?() false end def association?() true end def principal_value(record) v = record.send(table_name) if v && v.respond_to?(:to_a) && map && name != :count v.map(&:"#{name}") else v.try(name) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tabulatr2-0.9.2 | lib/tabulatr/renderer/association.rb |
tabulatr2-0.9.1 | lib/tabulatr/renderer/association.rb |
tabulatr2-0.9.0 | lib/tabulatr/renderer/association.rb |