Created
May 18, 2011 01:43
-
-
Save mgreenly/977842 to your computer and use it in GitHub Desktop.
respond_to respond_with
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# apps/data_tables/orders_index.rb | |
class OrdersIndex < DataTable | |
model Order | |
column :order_number, :width => 300 | |
joins :customer | |
column :first_name | |
column :last_name | |
end | |
column :memo | |
order [:memo, :first_name] | |
end | |
# apps/controllers/orders_controller.rb | |
class OrdersController < ApplicationController::Base | |
respond_to :html, :json | |
def index | |
render_datatable(OrdersIndex, params, format) | |
end | |
end | |
view | |
<table> | |
</table> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment