Using `type` in `where` block raise `ArgumentError`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start by running the inline Ruby reproduction and tracing the users.where block, especially attribute lookup for the column named type. Done means the block treats type as the database column and no longer raises ArgumentError; rerun the supplied script to verify the result.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Using where { type.is(...) } raises ArgumentError: wrong number of arguments (given 0, expected 1).
To Reproduce
Run script below:
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
require 'rom-sql'
require 'sqlite3'
end
config = ROM::Configuration.new(:sql, 'sqlite::memory')
config.gateways[:default].create_table(:users) do
primary_key :id
column :name, String
column :type, String
end
class Users < ROM::Relation[:sql]
schema do
attribute :id, Types::Serial
attribute :name, Types::String
attribute :type, Types::Strict::String.enum('User', 'Admin')
end
end
config.register_relation(Users)
container = ROM.container(config)
users = container.relations[:users]
# ArgumentError: wrong number of arguments (given 0, expected 1)
p users.where { name.is('Thomas') & type.is('Manager') }.to_a
Expected behavior
It does not raise an error but considers type as a database column.
My environment
- Ruby: 3.2.2
- rom-sql (3.6.4)
- Ngôn ngữ chính
- Ruby
- Star
- 220
- Fork
- 97
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rom-rb/rom-sql
-
bug help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
-
Relation#last removes combinesĐang mởbug help wanted
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
-
bug help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
-
bug help wanted
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
bug help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của rom-rb/rom-sql
Issue tương tự
-
`Time.at(t, in: nil)` returns UTC instead of the local time (or the time zone of `t`), unlike CRubyĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
swombat/souls-house#825 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openhab/openhab-jruby#571 ·
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
chatwoot/chatwoot#16591 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày