Sha256: 7435c78e4f91f2c3639682a64c9f1bf54a7f377925bf2e8937b131913b7f48ae

Contents?: true

Size: 383 Bytes

Versions: 6

Compression:

Stored size: 383 Bytes

Contents

module JTable
  module ActionController
    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jtable-rails-0.2.5 lib/jtable-rails/action_controller.rb
jtable-rails-0.2.4 lib/jtable-rails/action_controller.rb
jtable-rails-0.2.3 lib/jtable-rails/action_controller.rb
jtable-rails-0.2.2 lib/jtable-rails/action_controller.rb
jtable-rails-0.2.1 lib/jtable-rails/action_controller.rb
jtable-rails-0.2.0 lib/jtable-rails/action_controller.rb