Sha256: 12db6cb4a2b3bcf2f78cd6dca0300775ef1cb434bf4bda808c56cbecc054e446

Contents?: true

Size: 667 Bytes

Versions: 11

Compression:

Stored size: 667 Bytes

Contents

module Alchemy
  module Custom
    module Model
      module ModelUtilsMethods

        extend ActiveSupport::Concern

        included do

          def to_url
            layout = Alchemy::PageLayout.get_all_by_attributes(custom_model: self.class.to_s).select { |ly| ly["custom_model_action"] == "show" }.first
            page = Alchemy::Language.current.pages.find_by(page_layout: layout["name"]).parent
            page.urlname
          end

          def ui_title
            self.class.to_s.demodulize.downcase
          end

          def breadcrumb_name
            self.class.to_s.demodulize.titleize
          end

        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
alchemy-custom-model-3.2 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-3.1.5 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-3.1.4 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-3.1.3 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-3.1.2 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-3.1.1 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-3.1.0 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-2.2.2 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-3.0.0 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-2.2.1 lib/alchemy/custom/model/model_utils_methods.rb
alchemy-custom-model-2.2.0 lib/alchemy/custom/model/model_utils_methods.rb