module JTable::ActionController

Public Instance Methods

jtable_for_json(jtable_name, rel, jtable_params) click to toggle source
# 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