-
Notifications
You must be signed in to change notification settings - Fork 21
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
NoMethodError: undefined method `output_buffer=' #26
Comments
I get the same error message using rails 5.2.4.1 and the following versions of cells or slim:
|
It's because we merged a poorly tested PR where we'd allow >= slim-4.0. They must've changed the internal buffering. |
Any chance I can see the complete stacktrace? Alternatively, you could PR a test case, that'd be great. 🍻 You probably have to add the provoking code here in the cell: https://github.com/trailblazer/cells-slim/blob/master/test/slim_test.rb |
This was driving me mad for a good hour. At least I know why now! Stacktrace from my side:
|
Getting the same error when using
I don't know why it's trying to call the |
Any other fix possible, besides downgrading? |
The only way to fix this properly is to talk to the nice person making Also, bit confused, why does it say |
@apotonick Hey, how are you doing? |
Heyyyy @mrbongiolo great to see you again! Hope you're doing well! 🍻 I will have a look into slim the coming days, maybe it's easily fixable. |
Hey @apotonick! Did you had to time to look into this issue already? I fixed it for me by re-adding the rails helpers (f4f2afe) that Edit: Of course I mean the cells-slim gem. |
@richardboehme ☝️ Reverting this commit does the trick? 😮 |
Well at least it did for me. I just added def self.included(includer)
includer.send :include, ActionView::Helpers::FormHelper
includer.send :include, Helpers
end
module Helpers # include after AV helpers to override.
def with_output_buffer(block_buffer=ViewModel::OutputBuffer.new)
@output_buffer, old_buffer = block_buffer, @output_buffer
yield
@output_buffer = old_buffer
block_buffer
end
def capture(*args)
value = nil
buffer = with_output_buffer { value = yield(*args) }
return buffer.to_s if buffer.size > 0
value # this applies for "Beachparty" string-only statements.
end
# From FormTagHelper. why do they escape every possible string? why?
def form_tag_in_block(html_options, &block)
content = capture(&block)
form_tag_with_body(html_options, content)
end
def form_tag_with_body(html_options, content)
"#{form_tag_html(html_options)}" << content.to_s << "</form>"
end
def form_tag_html(html_options)
extra_tags = extra_tags_for_form(html_options)
"#{tag(:form, html_options, true) + extra_tags}"
end
def tag(name = nil, options = nil, open = false, escape = true)
super(name, options, open, true)
end
def content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block)
super(name, content_or_options_with_block, options, false, &block)
end
def concat(string)
@output_buffer << string
self
end
end
end to a module that I use in most of my cells and it worked for me. I guess the intention behind the commit is to remove the dependency to rails from this gem. So would it be possible to add these rails helpers to the cells-rails gem? |
I remember having a lot of problems with the hacky way Rails imiplements |
+1 |
Still an issue, worked around with this
then in my form
|
I was following traiblazer guide and stopped on the first rendering example http://trailblazer.to/guides/trailblazer/2.0/03-rails-basics.html
When I use cells-slim version 0.1.1 than I got this error in tests as well in browser
I was looking at trailblazer/cells#298 but that is old case.
I'm on rails 6.0.2.1.
Quick solution is to fix version
Can we provide some better error message so trb-newbie can overcome this situation ?
At least, we should update that guide with fixed cells-slim version.
The text was updated successfully, but these errors were encountered: