Created
January 3, 2015 19:26
-
-
Save daniel-rikowski/ca9709b3c5e7b951c9ba to your computer and use it in GitHub Desktop.
Rails 4.2 cannot serialize certain strings when PostgreSQL is used
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
gem 'activerecord', '4.2.0' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: '...', username: '...', password: '...') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
# drop_table :posts rescue nil | |
create_table :posts do |t| | |
t.binary :attachment | |
end | |
end | |
class Post < ActiveRecord::Base | |
serialize :attachment | |
end | |
class BugTest < Minitest::Test | |
def test_serialize | |
Post.create!(attachment: '\/') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment