In my .html.erb file, I have a lot of information to display. I'm completing it with a simple one: (using blueprint CSS)
<% in event for user.events%> & Lt; Div class = "span-5 range" & gt; Descriptor: & lt; / Div & gt; & Lt; Div class = "span-5 last" & gt; & Lt;% = h event.foo% & gt; & Lt; / Div & gt; & Lt; Br / & gt; & Lt;% end% & gt; How do I create it so that I can call some function which can render part of the information and I only refer it to the descriptor (a string literal) and the method for the event ("foo" "In this case).
I am new to the rail and I think it can be done using partial render, but I am not completely sure.
Thank you
render: partial = & gt; 'event' ,: collection = & Gt; @ User.events ,: Local = & gt; {: Descriptor = & gt; 'Descriptor' ,: method = & gt; 'Foo'} If you are using a newer version, this short version will also work:
render @ user.events, locals => gt: {descriptor = & gt; 'descriptor' ,: Method = & gt;'FOO '} your partial
Comments
Post a Comment