Sha256: 307bb82b95936a29a758cf2956c9aab81d5ad40e959547b459930aee55220e7b

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

module ScaffoldMarkup
  module Helpers
    class UrlHelper
      attr_reader :template

      def initialize(template)
        @template = template
      end

      def list_resource(model_class)
        template.send "#{model_class.model_name.underscore.pluralize}_path"
      end

      def resource(model_instance)
        template.send "#{model_instance.class.model_name.underscore}_path", model_instance.id
      end

      def new_resource(model_class)
        template.send "new_#{model_class.model_name.underscore}_path"
      end

      def edit_resource(model_instance)
        template.send "edit_#{model_instance.class.model_name.underscore}_path", model_instance.id
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scaffold_markup-0.0.1 lib/scaffold_markup/helpers/url_helper.rb