Sha256: 03ed306c8012f88a4c05cd079781737f5400821267f143c784de51ce592567bf

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

module Rao
  module ResourcesController::RestResourceUrlsConcern
    extend ActiveSupport::Concern

    included do
      helper_method :new_resource_path
      helper_method :collection_path
      helper_method :resource_path
      helper_method :edit_resource_path
    end

    private

    def new_resource_path
      resource_router.polymorphic_path(resource_class, action: :new)
    end

    def collection_path
      resource_router.polymorphic_path(resource_class)
    end

    def resource_path(resource)
      resource_router.polymorphic_path(resource)
    end

    def edit_resource_path(resource)
      resource_router.polymorphic_path(resource, action: :edit)
    end

    def resource_router
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rao-resources_controller-0.0.52.pre app/concerns/rao/resources_controller/rest_resource_urls_concern.rb