I am quite new to rails and ruby, and I have a little issue here: I
want to write a helper method which generates some erb code, which I
want to call and then eval from a template.
This is best illustrated with an example. I want a menu bar on a page
— in the erb template: —
rails_code = do_menu_bar_with([:back, :delete, :comment])
<%= eval(rails_code) %>
— end —
I know this is probably not working, a shitty approach and generally
flawed, but that’s basically what I need.
So now I have two questions, and I am happy for any answer :
Where would I put this method “do_menu_bar_…”? it surely does not
work in ApplicationController.
If this method returns erb code, how do I evaluate this after?
Surely not with eval, I guess …
Thanks in advance & greetings,