How can I add a comment in the middle of a call chain?
I see that Ruby throws parse error when I try to add a comment in the middle of a call chain like:
Tag.joins(:taggings)
# Wanted to add comment here cause it's long
# and takes multiple lines
.where(...)
.where(...)
.where(...)
# And here
.group(...)
.order(...)
Change to this structure:
Tag.joins(:taggings).
# Comment 1
# Comment 2
where(...).
where(...).
where(...).
# And here
group(...).
order(...)
Method .
Dot at end will instruct the parser that expression hasn't ended and logical method chain will arrive.
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