New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoking render in a view method ? #121
Comments
This is interesting. Perhaps provide some sample code and I can diagnose the issue. |
Sure. Here is code sample below. Notes:
module Ospweb::Views
def ats
h3 "Archetypes"
render :_ats_table, locals: { ats_stats: @ats_stats }
end
def _ats_table
# some HTML rendering here using @ats_stats
end
end |
Try this: module Ospweb::Views
def ats
h3 "Archetypes"
_ats_table({ :ats_stats => @ats_stats })
end
def _ats_table(locals)
# some HTML rendering here using @ats_stats
p "Paragraph tag using some stats: #{locals[:ats_stats]}"
end
end In Markaby / Mab helper methods are immediately output when called. So you can use view helpers with Slight reference: http://markaby.github.io The |
Thank you for your suggestion. It is actually a variant of calling of self._ats_table and passing locals. I'll try that. Thanks |
@ljulliar let me know how it went. |
It worked well indeed. Thank you.
Le mer. 24 août 2022, 11:00, karloscarweber ***@***.***> a
écrit :
… @ljulliar <https://github.com/ljulliar> let me know how it went.
—
Reply to this email directly, view it on GitHub
<#121 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAED4N3CDDWCS3IT54MVULV2XQDLANCNFSM555GJ5PA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi everyone,
First time testing Camping. So far I like it very much. I was just wandering if it's possible to invoke render from within a view method ? The reason I'm asking is because when I do so it seems that the instance variables initialized in the controller action doesn't seem to pass through the embedded render call. Am I missing something here ?
Thank you for your help.
The text was updated successfully, but these errors were encountered: