Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.13.0 - Errors with custom ID types in ActiveRecord #1845

Open
leifg opened this issue Mar 26, 2024 · 0 comments
Open

v0.13.0 - Errors with custom ID types in ActiveRecord #1845

leifg opened this issue Mar 26, 2024 · 0 comments

Comments

@leifg
Copy link

leifg commented Mar 26, 2024

We are using custom ID types for our primary keys:

class MyModel < ApplicationRecord
  attribute :id, MyModelId.new
end

MyModel.find(MyModelId.new("123"))

With 0.13.0 this results in type errors when regenerating DSL RBI files:

Expected T.any(TrueClass, FalseClass, String, Symbol, ActiveSupport::Multibyte::Chars, Numeric, ActiveModel::Type::Binary::Data, ActiveRecord::Type::Time::Value, Date, Time, ActiveSupport::Duration, T::Class[T.anything]) but found MyModelId for argument args https://srb.help/7002                                                                                                                                                                                                                                                                                 
    26 |    MyModel.find(MyModelId.new("123"))

Is there anyway to support id types defined by attribute :id?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant