kazumasayasui / rails Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rails/rails
Ruby on Rails
Home Page: https://rubyonrails.org
License: MIT License
This project forked from rails/rails
Ruby on Rails
Home Page: https://rubyonrails.org
License: MIT License
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
gem "activerecord", "~> 7.0.0"
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 :foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz, force: true do |t|
t.bigint :tenant_id, null: false
t.bigint :evaluation_template_sheet_item_id, null: false
t.bigint :evaluation_template_role_scene_restriction_id, null: false
t.timestamps
end
end
module Foo
module Bar
class Baz < ActiveRecord::Base
self.table_name = 'foo_bar_baz_foo_bar_baz_foo_bar_baz_foo_bar_baz'
end
end
end
class BugTest < Minitest::Test
# バグの内容
def test_should_group_by_multiple_fields_on_short_name_table
2.times do
Foo::Bar::Baz.create!(
tenant_id: 1,
evaluation_template_role_scene_restriction_id: 1,
evaluation_template_sheet_item_id: 2
)
end
res = Foo::Bar::Baz.group(:evaluation_template_role_scene_restriction_id, :evaluation_template_sheet_item_id).having("count(*) >= 2").count
# ここが期待通り動かない
assert_equal({ [1, 2] => 2 }, res)
end
end
{[1, 2]=>2}
Finished in 0.004607s, 217.0625 runs/s, 217.0625 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
{[2, 2]=>2}
1) Failure:
BugTest#test_should_group_by_multiple_fields_on_short_name_table [./active_record_gem.rb:79]:
Expected: {[1, 2]=>2}
Actual: {[2, 2]=>2}
1 runs, 1 assertions, 1 failures, 0 errors, 0 skips
Rails version: 7.0.0
Ruby version: ruby 3.0.2p107
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.