Permalink
Browse files

fix generator

  • Loading branch information...
1 parent 2e0d778 commit badb22c49f0f277f2524e38506df3d1b89b62548 @jsy committed May 6, 2011
Showing with 15 additions and 4 deletions.
  1. +13 −2 README.rdoc
  2. +2 −2 lib/generators/jqgrid/templates/controller.rb
15 README.rdoc
@@ -55,7 +55,18 @@ My gmail account : doinsist@gmail.com
o Add controller methods to ActionController::Base:
- jqgrid_post_data_for
- jqgrid_index_for
+ jqgrid_post_data_for
+ jqgrid_index_for
+ Now, a grid-enabled controller just needs:
+
+ COLUMNS = [:name, :email]
+ def index
+ jqgrid_index_for MyModel, params, COLUMNS
+ end
+
+ def post_data
+ jqgrid_post_data_for MyModel, params, COLUMNS
+ end
+
Released under the MIT license.
View
4 lib/generators/jqgrid/templates/controller.rb
@@ -14,11 +14,11 @@ class <%= class_name.pluralize %>Controller < ApplicationController
GRID_COLUMNS = [<%= columns.map {|x| ":#{x}"}.join(', ') %>]
def post_data
- jqgrid_post_data_for <%= model_name %>, params, GRID_COLUMNS
+ jqgrid_post_data_for <%= class_name %>, params, GRID_COLUMNS
end
def index
- jqgrid_index_for <%= model_name %>, params, GRID_COLUMNS
+ jqgrid_index_for <%= class_name %>, params, GRID_COLUMNS
end
end

0 comments on commit badb22c

Please sign in to comment.