Sha256: 9b4d4c0847c9cdaded68e57887a302af4609c8f7b84de095886d4d359b086ef1

Contents?: true

Size: 844 Bytes

Versions: 6

Compression:

Stored size: 844 Bytes

Contents

require 'inherited_resources'
module Admin
  class ResourcesController < AdminController

    inherit_resources


    helper_method :list_fields
    def list_fields
      resource_class.column_names
    end
    
    helper_method :show_fields
    def show_fields
      (resource_class.column_names-["id","created_by","updated_by","created_at","updated_at"])
    end

    helper_method :search_fields
    def search_fields
      []
    end


    def create
      create! { collection_path }
    end
    def update
      update! { collection_path }
    end


    protected

      def collection
        @search = end_of_association_chain.search(params[:q])
        get_collection_ivar || set_collection_ivar(@search.result.paginate(:page => params[:page], :per_page => per_page))
      end
     
      def per_page
        10
      end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
unknown_admin-0.1.4 lib/generators/unknown_admin/install/templates/resources_controller.rb
unknown_admin-0.1.3 lib/generators/unknown_admin/install/templates/resources_controller.rb
unknown_admin-0.1.2 lib/generators/unknown_admin/install/templates/resources_controller.rb
unknown_admin-0.1.1 lib/generators/unknown_admin/install/templates/resources_controller.rb
unknown_admin-0.1.0 lib/generators/unknown_admin/install/templates/resources_controller.rb
unknown_admin-0.0.1 lib/generators/unknown_admin/install/templates/resources_controller.rb