aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-08-14 18:13:32 -0400
committerGitHub <noreply@github.com>2017-08-14 18:13:32 -0400
commitcf91b96be3ff4aafd0ec29f5c34013792bddf33d (patch)
tree39b856d485ae26201e6554cdfe3d1c4056697607 /activerecord/lib/active_record
parentbef68862ae14244fb93e0abb4c16d06eec535c2d (diff)
parentdaad0736f30b7c665aa733512eac8d32873841db (diff)
downloadrails-cf91b96be3ff4aafd0ec29f5c34013792bddf33d.tar.gz
rails-cf91b96be3ff4aafd0ec29f5c34013792bddf33d.tar.bz2
rails-cf91b96be3ff4aafd0ec29f5c34013792bddf33d.zip
Merge pull request #30073 from yalab/fixture_binary_helper
Add `binary` helper method to fixtures.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/fixtures.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index ef302fc0a0..4940e122f4 100644
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -1065,6 +1065,10 @@ class ActiveRecord::FixtureSet::RenderContext # :nodoc:
def get_binding
binding()
end
+
+ def binary(path)
+ %(!!binary "#{Base64.strict_encode64(File.read(path))}")
+ end
end
end
end