Skip to content

Commit

Permalink
hotfix for a bug caused by string handling rails ~3.0.6 and up; occur…
Browse files Browse the repository at this point in the history
…red during any attempt to post to DR service
  • Loading branch information
janxious committed Aug 29, 2011
1 parent e8e8d9d commit be4a6eb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changelog
@@ -1,5 +1,8 @@
= doc_raptor Change Log

== doc_raptor 0.1.5
* fix bug caused by activesupport safebuffers in rails ~3.0.6 and up

== doc_raptor 0.1.4
* add support for creating async jobs

Expand Down
4 changes: 2 additions & 2 deletions doc_raptor.gemspec
Expand Up @@ -2,8 +2,8 @@ Gem::Specification.new do |s|
s.name = %q{doc_raptor}
s.description = %q{Provides a simple ruby wrapper around the DocRaptor API}
s.summary = %q{Provides a simple ruby wrapper around the DocRaptor API}
s.version = "0.1.4"
s.date = %q{2011-06-24}
s.version = "0.1.5"
s.date = %q{2011-08-29}
s.authors = ["Michael Kuehl","Joel Meador","Chris Moore"]
s.email = %q{michael@expectedbehavior.com}
s.summary = %q{wrap up the api for DocRaptor nicely}
Expand Down
11 changes: 9 additions & 2 deletions lib/doc_raptor.rb
Expand Up @@ -28,8 +28,15 @@ def self.create(options = { })
if options[:async]
query[:output => 'json']
end



# HOTFIX
# convert safebuffers to plain old strings so the gsub'ing that has to occur
# for url encoding works
# Broken by: https://github.com/rails/rails/commit/1300c034775a5d52ad9141fdf5bbdbb9159df96a#activesupport/lib/active_support/core_ext/string/output_safety.rb
# Discussion: https://github.com/rails/rails/issues/1555
options.map{|k,v| options[k] = options[k].to_str if options[k].is_a?(ActiveSupport::SafeBuffer)}
# /HOTFIX

response = post("/docs", :body => {:doc => options}, :basic_auth => { :username => api_key }, :query => query)

if block_given?
Expand Down

0 comments on commit be4a6eb

Please sign in to comment.