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

activerecord: Fix #find does not take string(s) as primary key(s). #643

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Aug 27, 2024

  1. activerecord: Fix #find does not take string(s) as primary key(s).

    ActiveRecord supports automatic conversion from String to Integer on
    `#find` call.
    
    The API document of `ActiveRecord::FinderMethods#find` says:
    
    > If the primary key is an integer, find by id coerces its arguments
    > by using to_i.
    > https://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find
    
    Unfortunately, it's difficult to add the `_ToI` type only if the primary
    key is an integer.  So this adds it always.
    tk0miya committed Aug 27, 2024
    Configuration menu
    Copy the full SHA
    feb48d9 View commit details
    Browse the repository at this point in the history