Displaying 1 result from an estimated 1 matches for "initialize_crud_control".
2006 Aug 04
4
DRY DRY DRY
...found http://dereksivers.com/rails-shared-controller.html
I quite like his generic controller, not Nub class though !
And I''ve adopted it for my project as:
controllers/basic_crud_controller.rb
...
class BasicCRUDController < ApplicationController
ITEMS_PER_PAGE = 15
before_filter :initialize_crud_controller
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def index
list
end
def list
@items = model_class.find :all, :limit => ITEMS_PER_PAGE,
:offset => ITEMS_PER_PAGE * (@sess[:...