DEV Community

Discussion on: Let's Use Rails Partials To Render Art from Magic: the Gathering!

 
isalevine profile image
Isa Levine • Edited

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.

So, this:

<%= render '/pages/cards/card', collection: session[:img_array], as: :img_hash %>

led to this:
screenshot of Rails error, saying :img_hash is undefined

Any idea why collection: isn't iterating through session[:img_array] and repeatedly passing each img_hash without the partial: explicitly there?

Thread Thread
 
andrewbrown profile image
Andrew Brown 🇨🇦

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