active-hash / active_hash

A readonly ActiveRecord-esque base class that lets you use a hash, a Yaml file or a custom file as the datasource
MIT License
1.19k stars 178 forks source link

Fix arguments of has_many method #306

Closed sontixyou closed 3 months ago

sontixyou commented 3 months ago

Problem being solved

fix this issue. https://github.com/active-hash/active_hash/issues/305

I think that merging this PR will eliminate the error that is occurring in the above issue.

Investigation

ActiveHash supports up to Rails ver5.0. I checked Rails ver5.0 to Rails ver7.1 Then I found that the argument structure of the has_many method is almost the same.

Hence, I modified it to pass the same arguments as ActiveRecord#has_many.

flavorjones commented 3 months ago

@sontixyou Thank you for submitting this. I would like to see a test for this usage, perhaps we can take the example @issei-m provided in #305?

sontixyou commented 3 months ago

@flavorjones Thanks for the reply! I have added a test on the changes. Could you please review them?

flavorjones commented 3 months ago

Looks great, thank you so much!

flavorjones commented 3 months ago

@kbrock We should probably ship this in a bugfix release. You OK if I go ahead and do that?

flavorjones commented 3 months ago

Shipped in https://github.com/active-hash/active_hash/releases/tag/v3.3.1