Module: ActionTabler::ColumnTypeFor::ClassMethods
- Defined in:
- lib/action_tabler/column_type_for.rb
Instance Method Summary collapse
-
#action_tabler_column_type_for(attribute, model) ⇒ Object
Returns a display column type for an attribute using reflection.
Instance Method Details
#action_tabler_column_type_for(attribute, model) ⇒ Object
Returns a display column type for an attribute using reflection.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/action_tabler/column_type_for.rb', line 7 def action_tabler_column_type_for(attribute, model) attribute = attribute.to_s attributes = attribute.split(".") if attributes.length > 1 reflection = model.reflect_on_association(attributes[0].to_sym) reflection.klass.action_tabler_column_type_for(attribute.gsub("#{attributes[0]}.", "")) else ActionTabler::JqueryDatatables.column_type_for(model.columns_hash[attribute].class) end end |