Module: AssetsHelper

Included in:
AssetsController
Defined in:
app/helpers/assets_helper.rb

Instance Method Summary collapse

Instance Method Details

#asset_content_path(content) ⇒ Object

construct the path for the assets content



7
8
9
10
11
12
13
14
15
# File 'app/helpers/assets_helper.rb', line 7

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

#content_partial(content, partial) ⇒ Object



2
3
4
# File 'app/helpers/assets_helper.rb', line 2

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

#edit_asset_content_path(content) ⇒ Object



16
17
18
# File 'app/helpers/assets_helper.rb', line 16

def edit_asset_content_path(content)
  asset_content_path(content) + "/edit"
end