Ruby on Rails Friday, September 28, 2012

Been a while, I had the closing bracket in the wrong spot:

send needs all the params, it was erroring on , if i put the closing bracket right after the data_type or name
<%= person_question.send(question.data_type.to_sym, question.name, :class => 'text_field') %>

On Monday, July 30, 2012 5:01:42 PM UTC-5, Me wrote:
Can you do f.send in a form?  I have questions and the data type stored in a db.

<% Question.all.each do |question| %>
          <div class="control-group">
            <%= f.send(:label, question.name), :class => 'control-label' %>
            <div class="controls">
              <%= f.send(question.data_type.to_sym, :question, :name) %> - <%= ' allergic to shellfish?' %>
            </div>
          </div>
        
        <% end %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/gR9GK0yFNKEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment