app/controllers/content_controller.rb
# convenience method to reference the uploaded content from the CMS (usually a PDF file or an image used in the static pages)
convenience method to reference the uploaded content from the CMS (usually a PDF file or an image used in the static pages)
convenience method to reference the uploaded content from the CMS ( usually a PDF file or an image used in the static pages )
def file
    content_upload_id = params[:id]
    raise "content upload without id" if content_upload_id.blank?
    if content_upload_id.to_i == 0
      content_upload = ContentUpload.find_by_link_name(content_upload_id)
    else 
      content_upload = ContentUpload.find_by_id(content_upload_id)
    end
    raise "content upload not found" if content_upload.blank?
    redirect_to(content_upload.content_server_url, status: :moved_permanently)
  end
def file content_upload_id = params [ :id ] raise "content upload without id" if content_upload_id . blank? if content_upload_id . to_i == 0 content_upload = ContentUpload . find_by_link_name ( content_upload_id ) else content_upload = ContentUpload . find_by_id ( content_upload_id ) end raise "content upload not found" if content_upload . blank? redirect_to ( content_upload . content_server_url , status : :moved_permanently ) end
convenience method to reference the uploaded content from the CMS (usually a PDF file or an image used in the static pages)
convenience method to reference the uploaded content from the CMS ( usually a PDF file or an image used in the static pages )
# if the id is not numeric, assume it's a link name # assume the id passed is numeric and find it by ID # send them to the file on the content server