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

with_options doesn't do deep merge #284

Open
Kukunin opened this issue Nov 8, 2017 · 1 comment
Open

with_options doesn't do deep merge #284

Kukunin opened this issue Nov 8, 2017 · 1 comment

Comments

@Kukunin
Copy link

Kukunin commented Nov 8, 2017

      with_options documentation: {required: true, type: 'integer'} do
        expose :posts_count, as: :posts, documentation: {example: 7}
        expose :followers_count, as: :followers, documentation: {example: 105}
        expose :following_count, as: :following, documentation: {example: 52}
        expose :bookmarks_count, as: :bookmarks, documentation: {example: 22}
      end

the example doesn't work, since documentation from nested attributes overrides parent's one.

I think they should be deep merged

@aCandidMind
Copy link

I agree that this would be better behavior in this case, but isn't this with_options from ActiveSupport which is sadly not merging options? So it's rather a bug there. This behavior is outlined in the docs. See the first NOTE which goes like this NOTE: Each nesting level will merge inherited defaults in addition to their own. and the text after it.

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

2 participants