I have a help method that looks a something like this:
def html_format(text, width=15, string="<wbr />", email_styling=false)
if email_styling
...... stuff
else
...... stuff
end
...... stuff
end
I'm having problems sending email_styling as true. Here is what I'm doing in the view:
<%= html_format(@comment.content, :email_styling => true) %>
Am I passing true incorrectly? Thanks
You are not passing it correctly. You need to do the following:
<%= html_format(@comment.content, 15, '<wbr />', true) %>
Alternatively you can use an options hash to pass your parameters:
def html_format(text, options = {})
opt = {:width => 15, :string => '<wbr />', :email_styling => false}.merge(options)
if opt[:email_styling]
...
end
end
So that you can make your call like this:
<%= html_format(@comment.content, :email_styling => true) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With