Method: MarkdownRecord::ViewHelpers#path_to_markdown_record
- Defined in:
- app/helpers/markdown_record/view_helpers.rb
#path_to_markdown_record(model, ext, download = false) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/helpers/markdown_record/view_helpers.rb', line 68 def path_to_markdown_record(model, ext, download = false) raise ArgumentError.new("A MarkdownRecord model must be provided.") unless model&.is_a?(::MarkdownRecord::Base) subdirectory = model.fragment_id path = Pathname.new(MarkdownRecord.config.mount_path).join(ext) path = path.join("download") if download path = path.join(subdirectory).to_s "/#{path}" end |