These are both excellent pieces of advice, thank you Andrew! I did incorporate the ||= bit (is there a name for that??) into the most recent refactor, and am on the lookout for other places to use it in my code. I gave you a shoutout at the bottom of my followup article where I used it, let me know if you want me to change it/remove it/link to something else of yours: dev.to/isalevine/using-rails-servi...
I'll definitely be referring back to your point about the simpler syntax for partials the next time I'm working with them too! I definitely like to be as overly-verbose and non-shortcut-y as possible at the start, but no question the shortened syntax looks better and more readable. :)
Also, this is interesting--I was refactoring to shorten-ify-icate the partials syntax, but apparently removing the partial: bit screws up how the collection: foo , as: :bar syntax.
These are both excellent pieces of advice, thank you Andrew! I did incorporate the
||=
bit (is there a name for that??) into the most recent refactor, and am on the lookout for other places to use it in my code. I gave you a shoutout at the bottom of my followup article where I used it, let me know if you want me to change it/remove it/link to something else of yours: dev.to/isalevine/using-rails-servi...I'll definitely be referring back to your point about the simpler syntax for partials the next time I'm working with them too! I definitely like to be as overly-verbose and non-shortcut-y as possible at the start, but no question the shortened syntax looks better and more readable. :)
👍👍👍
Also, this is interesting--I was refactoring to shorten-ify-icate the partials syntax, but apparently removing the
partial:
bit screws up how thecollection: foo , as: :bar
syntax.So, this:
led to this:
Any idea why
collection:
isn't iterating throughsession[:img_array]
and repeatedly passing eachimg_hash
without thepartial:
explicitly there?With
collection
, I supposed short form doesn't work since the logic is too difficult.So I guess short form only works for non-collection partials