How to get all locals as a hash in a partial view.
# mainview.html.haml:
= render 'v1', p1: 100, p2: 'some_value', _other_values_
in a partial view:
# _v1.html.haml
# do something here...
# render another partial view
= render 'another_view', locals: locals # what to write here???
How to access ALL variables in locals as a hash. I don't want to list all variables in locals.
local_assigns
.local_assigns #=> { p1: 100, p2: 'some_value', _other_values_ }
_v1.html.haml
= render 'another_view', local_assigns
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With