diff --git a/app/controllers/benefit_forms_controller.rb b/app/controllers/benefit_forms_controller.rb index a74befb..64b851e 100644 --- a/app/controllers/benefit_forms_controller.rb +++ b/app/controllers/benefit_forms_controller.rb @@ -7,7 +7,7 @@ class BenefitFormsController < ApplicationController def download begin - path = Rails.root.join('public', 'docs', params[:name]) + path = params[:name] file = params[:type].constantize.new(path) send_file file, :disposition => 'attachment' rescue diff --git a/app/views/benefit_forms/index.html.erb b/app/views/benefit_forms/index.html.erb index 3299355..3c48e5c 100644 --- a/app/views/benefit_forms/index.html.erb +++ b/app/views/benefit_forms/index.html.erb @@ -13,7 +13,7 @@
Click on PDF to download

- <%= link_to download_path(:type => "File", :name => "Health_n_Stuff.pdf") do %> + <%= link_to download_path(:type => "File", :name => "public/docs/Health_n_Stuff.pdf") do %>
@@ -39,7 +39,7 @@
Click on PDF to download

- <%= link_to download_path(:type => "File", :name => "Dental_n_Stuff.pdf") do %> + <%= link_to download_path(:type => "File", :name => "public/docs/Dental_n_Stuff.pdf") do %>