Skip to content

Conversation

@idanab-simplee
Copy link

@idanab-simplee idanab-simplee commented May 9, 2021

https://bugs.ruby-lang.org/issues/5759
There is no to_ary function for Enum::EnumValue, but it does respond to to_ary calls with method_missing.
For example, [STATUSES.some_enum_status].flatten will fail on undefined method 'to_ary'.
So this is meant to indicate rails to not use to_ary on this object.

Was tested on
Rails 4.2.11 + Ruby 2.3.8

https://bugs.ruby-lang.org/issues/5759
There is no to_ary function for Enum::EnumValue, but it does respond to to_ary calls with method_missing.
For example, [STATUSES.some_enum_status].flatten will fail on `undefined method 'to_ary'`.
So this is meant to indicate rails to not use to_ary on this object
@idanab-simplee
Copy link
Author

@odedniv is it possible to release a version with this fix?

@odedniv
Copy link
Owner

odedniv commented May 10, 2021

Thanks for the PR! 2 questions:

  1. Can respond_to_missing? be implemented in a more general way? Should it be a mirror of method_missing (i.e return true for anything that would be caught there)?
  2. Can you add tests? It should reflect the implementation, so perhaps hold on that until we have question 1 agreed upon.

Will definitely release a version once this PR is merged.

@idanab-simplee
Copy link
Author

@odedniv Yeah, we don't have capacity to do it now so we will add the change to our Simplee repo for now.
When il'l have some time I will add the tests.

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

Successfully merging this pull request may close these issues.

2 participants