Sha256: 96aa194edd1cd6699319378c97a8e2e713fbc98357b8d88ed93533e460e67e83

Contents?: true

Size: 629 Bytes

Versions: 4

Compression:

Stored size: 629 Bytes

Contents

module AssetsHelper
  def content_partial(content, partial)
    content.class.to_s.underscore.pluralize + "/" + content.media_type.to_s.underscore + "_" + partial.to_s
  end

  # construct the path for the assets content
  def asset_content_path(content)
    begin
      return url_for content
    rescue NoMethodError
      # it’s fine, if this fails this means, the engine should know about the url
    end
    engine = content.class.to_s.split("::").first + "::Engine"
    send(engine.constantize.engine_name).url_for content
  end
  def edit_asset_content_path(content)
    asset_content_path(content) + "/edit"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fassets_core-0.4.0 app/helpers/assets_helper.rb
fassets_core-0.3.1 app/helpers/assets_helper.rb
fassets_core-0.3.0 app/helpers/assets_helper.rb
fassets_core-0.2.0 app/helpers/assets_helper.rb