def index
      self.records = model.send index_scope
      self.records =  model.send(:search, params[:search]) if should_search?
      self.records = paginate(records) if respond_to? :per_page

      respond_to do |format|
        format.html { render :index }
        format.json { render json: records }
      end
    end
def index
      self.records = model.send index_scope
      self.records =  model.send(:search, params[:search]) if should_search?
      self.records = paginate(records) if respond_to? :per_page

      respond_to do |format|
        format.html { render :index }
        format.json { render json: records }
      end
    end
GET /model