DEV Community

Cover image for My Ruby Journey: Hooking Things Up

My Ruby Journey: Hooking Things Up

Edison Yap on November 03, 2018

My Ruby Journey: Hooking Things Up I’ve only recently just begun my Ruby/Rails journey (worked for little less than a year), and one day...
Collapse
 
tomk32 profile image
Thomas R. Koll

Nitpicker here, in the ruby world we indent with only two spaces.

As you're learning Rails, have a look at ActiveSupport::Concern, it's used quite a lot in more recent Rails apps.

Keep learning, I'm sure you'll enjoy programming Ruby :)

Collapse
 
edisonywh profile image
Edison Yap

Oh yes definitely! I was copying it from multiple notes app and got messed up haha, thanks for pointing out!

What's your opinion on Concerns? I've heard a lot of people saying concerns are bad, but I've also seen DHH being a big advocate for it.

Collapse
 
tomk32 profile image
Thomas R. Koll

I like them (in Rails) even though they add such little functionality. It's more about the concept of moving code from your models and controllers into separate files that contain a functionality in its entirety. Make those models small again :)

Thread Thread
 
edisonywh profile image
Edison Yap

I see! Definitely agree on slimming down. My company's go-to for slimming down model is always Service Objects, so that's what I've been used to.

I think one of these days I should definitely try out concerns! Thanks for sharing :)

Thread Thread
 
tomk32 profile image
Thomas R. Koll

Serivce Objects and PORO is a must when you write a rake tasks. Processing the input and passing it to the service is all my rake tasks do. Much easier to test.

Collapse
 
tomk32 profile image
Thomas R. Koll

Especially when you're in Japan.

Collapse
 
annarankin profile image
Anna Rankin

Nice work! It's so much fun to dive into the "why" behind these things - and you did quite a nice job of explaining your journey. Thanks!

Collapse
 
edisonywh profile image
Edison Yap

Thanks for the kind words Anna! Glad you liked it :)