Sha256: 51b1eff2baa843fcc8e2d79ef64fafc904e2648ba223c42d90f67d7274e738b6

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

module Morpheus
  module UrlSupport

    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods

      def url_name
        @url_name ||= model_name.underscore
      end
      alias_method :singular_url_name, :url_name

      def plural_url_name
        url_name.pluralize
      end

      def set_base_url(url_name)
        @url_name = url_name
      end

      def attributes_root
        @attributes_root ||= model_name.underscore
      end

      def set_attributes_root(name)
        @attributes_root = name
      end

      def set_base_model_name(name)
        set_base_url(name)
        set_attributes_root(name)
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
morpheus-0.4.0 lib/morpheus/mixins/url_support.rb
morpheus-0.3.9 lib/morpheus/mixins/url_support.rb
morpheus-0.3.8 lib/morpheus/mixins/url_support.rb
morpheus-0.3.7 lib/morpheus/mixins/url_support.rb