Replies: 1 comment
-
|
This is probably because Phlex wraps the block when calling
class Bar < Phlex::HTML
def template
render Foo.new do |f|
f.test_method
end
end
end
class Foo < Phlex::HTML
def template
yield
end
def test_method
text "Hello!"
end
endAlternatively, def template(&)
div(&)
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Phlex 1.2.1:
Expected result: "Hello"
Actual result: "no method error
test_method..."Why is the block being evaluated in the context of Bar rather than the context of Foo?
If I use the internal method to take my block back, everything works as expected:
Expected result: "Hello"
Actual result: "Hello"
Any recommendations here? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions