Skip to content

Instantly share code, notes, and snippets.

@phoet phoet/example.rb
Last active Oct 10, 2019

Embed
What would you like to do?
pp_bug
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", '6.0.0'
gem 'pg'
end
require 'pg'
require "active_record"
require 'active_support'
require "minitest/autorun"
require "logger"
ActiveRecord::Base.establish_connection(adapter: "postgresql", database: "penseo_test2")
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
create_table :posts, force: true do |t|
t.json(:data)
end
end
class Post < ActiveRecord::Base
def self.filter_attributes
# Rails.application.config.filter_parameters += [:password]
[:password]
end
end
class BugTest < Minitest::Test
def test_fails
post = Post.create! data: {}
puts "with string ok"
post.data['11'] = {}
pp post
puts "with int 💥"
post.data[11] = {}
pp post
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.