Class: Snaptable::Helpers::Table
- Inherits:
-
Constructor::BaseTable
- Object
- SimpleDelegator
- Constructor::BaseTable
- Snaptable::Helpers::Table
- Defined in:
- lib/snaptable/helpers/table.rb
Defined Under Namespace
Modules: Search
Instance Method Summary collapse
-
#initialize(parent, model, collection = nil, options = {}) ⇒ Table
constructor
A new instance of Table.
- #model ⇒ Object
- #values(element) ⇒ Object
Methods inherited from Constructor::BaseTable
Methods included from Constructor::Renderer
Methods included from Constructor::Collection
#collection, #filter, #records
Methods included from Constructor::Sortable
#css_class, #direction, #page, #sort_column, #sort_direction, #sortable
Constructor Details
#initialize(parent, model, collection = nil, options = {}) ⇒ Table
Returns a new instance of Table.
8 9 10 11 |
# File 'lib/snaptable/helpers/table.rb', line 8 def initialize(parent, model, collection = nil, = {}) super(parent, collection, ) @model = model end |
Instance Method Details
#model ⇒ Object
23 24 25 |
# File 'lib/snaptable/helpers/table.rb', line 23 def model @model end |
#values(element) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/snaptable/helpers/table.rb', line 13 def values(element) element.attributes.map do |attr_name, attr_value| if attr_value.is_a?(Date) || attr_value.is_a?(Time) || attr_value.is_a?(DateTime) l(attr_value, format: :short) else attr_value end.to_s end end |