Hey all. I have the following:
-
A partial function which basically tests to see which level the object is at.
<% if defined? endpointobject.at(0).field_name != nil %>
-
A helper function in my config.rb:
helpers do def get_json_sample(endpointobject) partial "render_json_sample", :locals => { endpointobject => :endpointobject }; end end
-
A Hashie::mash, data.payment_methods
-
A template erb.
If I call the partial directly from the template erb, like so:
<%= partial "render_json_sample", locals: { endpointobject: data.payment_methods } %>
… the endpoint.inspect
method works, everything looks good.
BUT if I call the helper function instead, like so:
<%= get_json_sample(data.payment_methods) %>
… I get an error RuntimeError at /
invalid locals key: [#<Hashie::Mash
Theoretically, shouldn’t these be producing the same output. One goes from A -> C, the other goes from A -> B -> C without touching the Hashie::mash.
An endpoint.inspect in my helper function reveals an appropriately-formed object, but it appears to get malformed in transit. Can anyone possibly shed some light into this for me?
Thanks very much,
Chris