Note that there are some explanatory texts on larger screens.

plurals
  1. POblock method output is generating twice
    primarykey
    data
    text
    <p>I write a block method to print a list</p> <pre><code>def column (&amp;block) if block_given? content_tag(:li, capture(self, &amp;block)) else content_tag(:li, "") end end </code></pre> <p>and using it as</p> <pre><code>&lt;%= data_list_for @leads, [" :10", "Age:30", "Contact:140", "Phone:140", "Email:180", "Company:100", ""] do |l| %&gt; &lt;%= l.column { |c| link_to "&amp;nbsp;".html_safe, "leads/details/#{c.object.id}", :class=&gt;:plus, :remote=&gt;true } %&gt; &lt;%= l.column { |c| c.object.age } %&gt; &lt;%= l.column { |c| c.object.contact.complete_name } %&gt; &lt;%= l.column { |c| c.object.contact.phones.blank? ? "-" : c.object.contact.phones.first.phone_number } %&gt; &lt;%= l.column { |c| c.object.contact.emails.blank? ? "-" : c.object.contact.emails.first.email } %&gt; &lt;%= l.column { |c| c.object.company.title } %&gt; &lt;%= l.column do |c| %&gt; &lt;%= options_menu do |m| %&gt; &lt;%= m.item link_to 'Show', lead_path(c.object) %&gt; &lt;%= m.item link_to 'Edit', edit_lead_path(c.object) %&gt; &lt;%= m.item link_to 'New Note', "leads/#{c.object.id}/notes/new", :class=&gt;"display-newxdoc", :id=&gt;c.object.id %&gt; &lt;%= m.item link_to 'Create Opportunity', new_lead_opportunity_path(c.object) %&gt; &lt;% end %&gt; &lt;% end %&gt; &lt;% end %&gt; </code></pre> <p>Every thing is working fine. But the only problem is that <code>options_menu</code> is generating twice. Means two option_menus are there. I traced out one menu is from <code>l.column</code> command because it has proper formating of column, other is generating by its on block in the view, How can i stop it for doing twice?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload