E
E
eldar_web2015-05-19 20:03:00
Ruby on Rails
eldar_web, 2015-05-19 20:03:00

How to find out the contents of a field (like f.name) from a form in Rails?

Here, when editing, the value is not explicitly set in the form through value='<%= ... %>', but is somehow generated.
How can I find out what value a certain field has. So <%= f.name %> doesn't work.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dima, 2015-05-19
@MAXOPKA

Look for a method form_for, take its first argument, and outputаргумент.name

V
Viktor Vsk, 2015-05-20
@viktorvsk

f.object.name

E
Eugene Burmakin, 2015-05-20
@Freika

If the form looks like form_for @object (and so on), then you need to substitute @object.attribute in the value, in your case @object.name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question