Module: JTable::ActionController

Defined in:
lib/jtable-rails/action_controller.rb

Instance Method Summary collapse

Instance Method Details

#jtable_for_json(jtable_name, rel, jtable_params) ⇒ Object



3
4
5
6
7
# File 'lib/jtable-rails/action_controller.rb', line 3

def jtable_for_json(jtable_name, rel, jtable_params)
  jtable_params = HashWithIndifferentAccess.new(jtable_params)
  items = rel.send("jtable_#{jtable_name}_paginate",jtable_params[:limit], jtable_params[:offset])
  {:total_items => rel.count, :items => items.collect(&("jtable_#{jtable_name}_item").to_sym)}
end