I have an interpolated ruby code in a HAML document that looks like the following:
: Javascript A = {'something': "# {model.attribute.present ?? method (parameter): ''}"} However, the method (parameter) is certain parameters With the exception being throwing, I can save the exception. When the exception is thrown, I would like to map 'some' key with something else.
I am not making clear on the correct syntax how I have tried to do some things with HAML code / Ruby interpolation, but it is not working.
Thank you!
You should take this line
model. Attribute.present? ? Method (parameter): '' and make a helper method out of it
class ApplicationHelper def some_method model.attribute.present? ? Method: This is your value in case of "rescue" some more "#definance end" Then your ham becomes trivial
: Javascript A = {'Something': "# {some_method}"}
Comments
Post a Comment