Hate Things that Depend on Whitespace
I’m writing a rails app and was trying to use a scope with a variable. My code looked like this:
scope :ternal, -> (kind) { where kind: kind }
This worked fine on my laptop, but when I uploaded it to my production server, the app wouldn’t start and I got a message something like this:
syntax error, unexpected tLPAREN_ARG, expecting keyword_do_LAMBDA or tLAMBEG scope :ternal, -> (kind) { where kind: kind }
Do you see the problem? It’s the space after the arrow. To fix things, I just needed to take it out. So this works fine:
scope :ternal, ->(kind) { where kind: kind }
I’m not much of a programmer, but whitespace-dependent stuff drives me nuts. I think this is actually why I dislike using python. I didn’t think ruby ever had anything like this, but I guess they do.
Thanks to this site for pointing it out to me.