Accessing models and their methods in the rails console is one of my favourite
Date methods are arguably the best, there is just no way Time.now.tomorrow, Time.now.yesterday, or using .first, .second(I remember I told so many people the first time I found this)
There is just so many methods out of the box that are very useful
I took me a bit of time however to grasp the unless this do that or return this if that then another statement after this.
I still use rails for any new projects I create
DATES. That's another one that I forgot — and such an easy one to contrast with JS:
It's interesting that you mention this syntax as baffling for you:
unless this do that or return this if that
For me this is the specific feature that felt like I'm playing with lego. When I later learned JS, I've developed a strong preference for refactoring if/else statements this way as well and literally everyone compliments me on this :D I wish all JS devs were trained in Ruby first so they'd write less of a spaghetti code.
TESTS! I forgot about how fun and stress-free testing in Ruby is. Thank you. Maybe this is going to be next blog material.
Do you have any Ruby favorite tricks and tips? Any method(s) that deserve special appreciation?
Time.now.tomorrow
,Time.now.yesterday
, or using.first
,.second
(I remember I told so many people the first time I found this)I took me a bit of time however to grasp the
unless this do that
orreturn this if that
then another statement after this.I still use rails for any new projects I create
DATES. That's another one that I forgot — and such an easy one to contrast with JS:
It's interesting that you mention this syntax as baffling for you:
For me this is the specific feature that felt like I'm playing with lego. When I later learned JS, I've developed a strong preference for refactoring if/else statements this way as well and literally everyone compliments me on this :D I wish all JS devs were trained in Ruby first so they'd write less of a spaghetti code.
It took me a while to grasp it but once I understood it I really loved it. Thanks for the article it looks interesting.