Module: Hirb::Views::Kangaroo
- Defined in:
- lib/kangaroo/hirb.rb
Instance Method Summary collapse
Instance Method Details
#get_kangaroo_fields(obj) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/kangaroo/hirb.rb', line 8 def get_kangaroo_fields obj fields = obj.class.attribute_names # if query used select if obj.attributes.keys.sort != obj.class.attribute_names.sort selected_columns = obj.attributes.keys sorted_columns = obj.class.attribute_names.dup.delete_if {|e| !selected_columns.include?(e) } sorted_columns += (selected_columns - sorted_columns) fields = sorted_columns.map {|e| e.to_sym} end fields end |
#kangaroo__model__base_view(obj) ⇒ Object
4 5 6 |
# File 'lib/kangaroo/hirb.rb', line 4 def kangaroo__model__base_view obj { :fields => get_kangaroo_fields(obj) } end |