activerecord - Rails pass array to partial using collection -
i'm trying iterate through regular array (not activerecord), , render partial using each element.
in view (i'm using slim):
== render partial: "layouts/display_elements", collection: my_array
my partial (for now) contains:
= "#{display_element}"
however, i'm getting following error:
undefined local variable or method `display_element' #<#<class:0x007f7fe2e6ca58>:0x007f7fe51e0408>
is limit of imposed not using activerecord? have resort to
= my_array.each |e|
i not familiar slim-lang, think adding :as
option work you:
== render partial: "layouts/display_elements", collection: my_array, as: :display_element
this allow access collection my_array
display_item
local variable within partial.
Comments
Post a Comment