Skip to content
New issue

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

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

Already on GitHub? # to your account

Remove Forwardable and release 0.2.5 #100

Merged
merged 2 commits into from
May 15, 2023
Merged

Conversation

richardboehme
Copy link
Collaborator

Fixes #99

@richardboehme richardboehme requested a review from apotonick May 15, 2023 08:37
def_delegators :model, :persisted?, :to_key, :to_param, :id
%i(persisted? to_key to_param id).each do |method|
define_method method do
model.public_send(method)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not simply use https://www.rubydoc.info/gems/activesupport/Module:delegate as you suggested in the first place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I updated the code to use rails' delegate method instead.

Extending Ruby's Forwardable module adds a `delegate` method to each
form which overrides the often used `delegate` method of Rails. To
prevent this we just use the `delegate` method of Rails instead.

Fixes #99
@richardboehme richardboehme force-pushed the boehme/remove-forwardable branch from f28b24b to 271574c Compare May 15, 2023 11:49
Copy link
Member

@apotonick apotonick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💚 Danke!

@richardboehme richardboehme merged commit 478d59c into master May 15, 2023
@richardboehme richardboehme deleted the boehme/remove-forwardable branch May 15, 2023 14:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delegating from form object causes ArgumentError with 0.2.4
2 participants