Passing parameter thru fields_for text_field

Hello all,

I have a helper function called “add_link” which will insert html to a
partial.

  • ProjectsHelper -
    def add_link(name, irb=nil)
    link_to_function name do |page|
    page.insert_html :top, :irbs, :partial => ‘projects/irb’, :object
    => Irb.new, :locals => { :irb_id => irb }
    end
    end

  • _irb.html.erb -

<% new_or_existing = irb.new_record? ? 'new' : 'existing' %> <% prefix = "project[#{new_or_existing}_irb_attributes][]" %> <% error_messages_for :irb %>

<% fields_for prefix, irb do |irb_form| -%>

<%= irb_form.text_field "IRB" %>

<%= link_to_function "remove", "jQuery(this).fadeOut(500, function()

{ $(this).up(’.irb’).remove(); } );" %>

<% end -%>

How can I pass an id to the text field like the “<%= text_field_tag
“IRB”, irb_id %>”

I would like to display the IRB value in the text field when inserted.

Thanks for any help with this.

JohnM

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs