mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-21 15:40:58 +00:00
1 line
2.6 KiB
JSON
1 line
2.6 KiB
JSON
[{"user_id": 41657, "stars": [], "topic_id": 46766, "date_created": 1318973107.027822, "message": "I'm sure this is buried in the docs of some project that middleman includes, but I can't find a way to pass a variable to a partial. I thought maybe it was using the Sinatra partial extension described here: http://www.sinatrarb.com/faq.html#partials but if I call with:", "group_id": 10410, "id": 2379843}, {"user_id": 41657, "stars": [], "topic_id": 46766, "date_created": 1318973205.548398, "message": "putting a \"-p locals\" in the partial's haml file, gives \"{}\" and so, of course, trying to access amount gives an error. Clues welcomed, for what is likely a noobie question. thanks!", "group_id": 10410, "id": 2379858}, {"user_id": 41657, "stars": [], "topic_id": 46766, "date_created": 1318974452.792371, "message": "Thanks. In the meantime I worked out that the following works when I put it into the partial, but I'll look at Padrino for a doubtless prettier approach:", "group_id": 10410, "id": 2380081}, {"user_id": 41657, "stars": [], "topic_id": 46766, "date_created": 1318974455.402838, "message": "-amount = locals[:amount]\n-amount_text = locals[:amount_text]\n", "group_id": 10410, "id": 2380084}, {"user_id": 41657, "stars": [], "topic_id": 46766, "date_created": 1318973134.6825459, "message": " = partial(:paypal_button, locals => {:amount => 1, :amount_text => @t.donate_1})\n ", "group_id": 10410, "id": 2379849}, {"user_id": 7586, "stars": [], "topic_id": 46766, "date_created": 1318973969.5600331, "message": "We use Padrino's partials (more Rails-like than Sinatra's). Docs are here: http://www.padrinorb.com/api/classes/Padrino/Helpers/RenderHelpers.html", "group_id": 10410, "id": 2379988}, {"user_id": 41657, "stars": [], "topic_id": 46766, "date_created": 1318974637.8951681, "message": "Hmm, reading this would suggest that the locals should be locals, but it seems that while tiny is doing the first step of recognising and mapping the locals hash, nothing is interpreting that and making them locals. Perhaps I'm supposed to do something else somewhere?", "group_id": 10410, "id": 2380110}, {"user_id": 7586, "stars": [], "topic_id": 46766, "date_created": 1319002498.522197, "message": "In the first code post above, you're missing the : on :locals", "group_id": 10410, "id": 2383041}, {"user_id": 41657, "stars": [], "topic_id": 46766, "date_created": 1319047277.453038, "message": "doh! Indeed that was it. And somewhere along the line I fixed it in my code, so sure enough I can remove the hack above and it all works as expected. Thx.", "group_id": 10410, "id": 2386027}] |