Skip to content

Instantly share code, notes, and snippets.

@rafaelfranca
Forked from alexcameron89/28718.rb
Last active July 4, 2022 20:11
Show Gist options
  • Save rafaelfranca/dd0a2d32397fd9c3a596a349e6601309 to your computer and use it in GitHub Desktop.
Save rafaelfranca/dd0a2d32397fd9c3a596a349e6601309 to your computer and use it in GitHub Desktop.
A Reproduction Script for Rails issue #28718
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", "5.0.2"
gem "sqlite3"
end
require "active_record"
require "minitest/autorun"
require "logger"
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
create_table :users do |t|
t.string :first_name
t.string :last_name
end
end
class User < ActiveRecord::Base
end
class BugTest < Minitest::Test
def test_frozen_attributes
user = User.new(first_name: 'Alex', last_name: 'Kosh')
refute user.first_name.frozen?
x = User.new(user.attributes)
x.inspect
refute user.first_name.frozen?
refute user.first_name.frozen?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment