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

JSON view block #74

Open
vladfaust opened this issue Mar 24, 2019 · 2 comments
Open

JSON view block #74

vladfaust opened this issue Mar 24, 2019 · 2 comments
Assignees
Labels

Comments

@vladfaust
Copy link
Member

  json @worlds.map do |world|
    Views::World.new(world)
  end

Is treated as builder variant and

json @worlds.map { |world| Views::World.new(world) }

Is not.

@vladfaust vladfaust added the bug label Mar 24, 2019
@vladfaust vladfaust added this to the next patch milestone Mar 24, 2019
@vladfaust vladfaust self-assigned this Mar 24, 2019
@vladfaust
Copy link
Member Author

Also doesn't work for

json tips: @tips.map do |tip|
  View::Tip.new(tip)
end
   7.     def render_to_application_json(io : IO)
>  8.       ({tips: @tips.map}).to_json(io)
   9.     end

'Array(Models::Tip)#map' is expected to be invoked with a block, but no block was given

@vladfaust vladfaust reopened this May 13, 2019
@vladfaust
Copy link
Member Author

Should put more thought into it. Given:

json content_type: "application/json-a" do
  builder do
    field "foo", @foo
    field "bar", @bar
  end
end

What if I just wanted to add builder block arg?

json content_type: "application/json-a" do |builder|
  builder do
    field "foo", @foo
    field "bar", @bar
  end
end

@vladfaust vladfaust removed this from the 0.7.2 milestone May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant