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

exclude :field does not work as expected for views #207

Closed
tpltn opened this issue Mar 24, 2020 · 0 comments · Fixed by #208
Closed

exclude :field does not work as expected for views #207

tpltn opened this issue Mar 24, 2020 · 0 comments · Fixed by #208

Comments

@tpltn
Copy link
Contributor

tpltn commented Mar 24, 2020

Hello! I found small bug with field exclusion and views:

class Print < Blueprinter::Base
  field :first_name
  field :last_name

  view :exclude_last_name do
    exclude :last_name
  end

  view :foo do
    include_view :exclude_last_name
  end
end

result = Print.render_as_hash({first_name: 1, last_name: 2}, view: :foo)

Expected:

{:first_name=>1}

Got:

{:first_name=>1, :last_name=>2}
@tpltn tpltn changed the title exclude :fields does not work as expected for views exclude :field does not work as expected for views Mar 24, 2020
philipqnguyen added a commit that referenced this issue Apr 7, 2020
fix field exclusion for views

Resolves #207
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 a pull request may close this issue.

1 participant