Outputting value of a field in fields_for, not an input tag #797

Closed
digitalplaywright opened this Issue Feb 11, 2012 · 2 comments

Comments

Projects
None yet
3 participants

I have a form for an object that accepts nested attributes and would like to access the value of the object that are currently being processed in fields_for. Is this possible?

I know how to generate a disabled input tag, but that is not a nice solution since I don't intend to edit this field.

Example code:

  = semantic_form_for @order do |f|
    = f.semantic_fields_for(:line_items) do |fr|
        = fr.select  "quantity", (1..10).step(1).to_a, :selected => 1
        Price is: #{put vale of |fr|.price here}
Contributor

mhuggins commented Feb 16, 2012

Try using fr.object.price.

jwaldrip commented Mar 1, 2012

@mhuggins is correct that should get the objects value as plain text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment