Sha256: 0db4f856ec6e5b5e6cc06f3a23c1ef66f8d7925fa9b28977618ebb3a2908b37c

Contents?: true

Size: 473 Bytes

Versions: 10

Compression:

Stored size: 473 Bytes

Contents

require 'core_ext/ruby/module/include_anonymous'

module UrlHelper
  def self.included(base)
    base.send(:helper_method, public_instance_methods)
  end

  include do
    def public_url
      public_url_for(resources.reject { |r| r.respond_to?(:new_record?) && r.new_record? })
    end

    def public_url_for(resources, options = {})
      resources -= [:admin, site]
      resources.empty? ? "http://#{site.host}" : polymorphic_url(resources, options)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
adva-core-0.0.14 app/helpers/url_helper.rb
adva-core-0.0.13 app/helpers/url_helper.rb
adva-core-0.0.9 app/helpers/url_helper.rb
adva-core-0.0.8 app/helpers/url_helper.rb
adva-core-0.0.7 app/helpers/url_helper.rb
adva-core-0.0.6 app/helpers/url_helper.rb
adva-core-0.0.5 app/helpers/url_helper.rb
adva-core-0.0.4 app/helpers/url_helper.rb
adva-core-0.0.2 app/helpers/url_helper.rb
adva-core-0.0.1 app/helpers/url_helper.rb