Sha256: ca9c6610c651330db3b92546c200b06e0ebccbdf8375519319b64d8c66201883

Contents?: true

Size: 888 Bytes

Versions: 6

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true

module EacRailsBase0
  module Patches
    module EacRailsUtilsLinksHelper
      class << self
        def included(base)
          base.prepend(InstanceMethods)
          base.prepend(::CanCanDryHelper)
        end
      end

      module InstanceMethods
        def short_object_link(object, action = nil, options = {})
          value_or_sign(object, '') do |value|
            path = object_path(value, action)
            link_to '', url_for(path), options if can_by_path?(path, options[:method])
          end
        end

        def object_path_by_class(*args)
          super(*args).gsub(/_url\z/, '_path')
        end
      end
    end
  end
end

require 'eac_rails_utils/links_helper'
patch = EacRailsBase0::Patches::EacRailsUtilsLinksHelper
target = EacRailsUtils::LinksHelper
target.prepend(patch) unless target.included_modules.include?(patch)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
eac_rails_base0-0.68.6 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.68.5 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.68.4 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.68.3 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.68.2 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb
eac_rails_base0-0.68.1 lib/eac_rails_base0/patches/eac_rails_utils_links_helper_patch.rb