Skip to content
Browse files

Switch RAILS_ROOT to Rails.public_path

  • Loading branch information...
1 parent 078e81f commit 28388d1f96b7890309108ce615539ed65d38acdf @mhourahine mhourahine committed Oct 26, 2012
Showing with 6 additions and 6 deletions.
  1. +3 −3 lib/ezprint/processors/pdfkit.rb
  2. +3 −3 lib/ezprint/processors/prince.rb
View
6 lib/ezprint/processors/pdfkit.rb
@@ -12,9 +12,9 @@ def self.process(html_string, options = {})
def self.process_html(html)
# reroute absolute paths
- html.gsub!("src=\"/", "src=\"#{RAILS_ROOT}/public/")
- html.gsub!("href=\"/", "src=\"#{RAILS_ROOT}/public/")
- html.gsub!("url(/", "url(#{RAILS_ROOT}/public/")
+ html.gsub!("src=\"/", "src=\"#{Rails.public_path}/")
+ html.gsub!("href=\"/", "src=\"#{Rails.public_path}/")
+ html.gsub!("url(/", "url(#{Rails.public_path}/")
html
end
end
View
6 lib/ezprint/processors/prince.rb
@@ -25,9 +25,9 @@ def self.cmd(options)
def self.process_html(html)
# reroute absolute paths
- html.gsub!("src=\"/", "src=\"#{RAILS_ROOT}/public/")
- html.gsub!("href=\"/", "src=\"#{RAILS_ROOT}/public/")
- html.gsub!("url(/", "url(#{RAILS_ROOT}/public/")
+ html.gsub!("src=\"/", "src=\"#{Rails.public_path}/")
+ html.gsub!("href=\"/", "src=\"#{Rails.public_path}/")
+ html.gsub!("url(/", "url(#{Rails.public_path}/")
html
end
end

0 comments on commit 28388d1

Please sign in to comment.
Something went wrong with that request. Please try again.