Skip to content

Instantly share code, notes, and snippets.

@senny
Created September 27, 2013 07:51
Show Gist options
  • Save senny/6725398 to your computer and use it in GitHub Desktop.
Save senny/6725398 to your computer and use it in GitHub Desktop.
require 'bundler'
Bundler.setup(:default)
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'rails_bug')
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
drop_table "posts"
create_table :posts do |t|
t.string :tags, array: true
end
end
class Post < ActiveRecord::Base
has_many :comments
end
class BugTest < Minitest::Test
def test_array_stuff
post = Post.create!(tags: ["one", "two", "three"])
post.update_column(:tags, ["four", "five"])
assert_equal ["four", "five"], Post.first.tags
end
end
@senny
Copy link
Author

senny commented Feb 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment