Given model has_many associations belongs_to dependency and
dependency has_many associations belongs_to model
> @model = Model.find(:id)
and
> forms_for @model do |f|
what is 'f'?
> f.fields_for :associations do |ff|
what is 'ff'?
How do I access dependencies on the named associations?
I have inspected these things and the volume of data that each
contains is such that I cannot post it here. My difficulty is that I
cannot seem to get a handled
I will try to give an example:
forms_for @model do |f|
f.fields-for :associations do |ff|
ff.text-field :model_id
ff.text_field :dependency_id:
ff.dependency.some_attribute # this display value simply does not
work.
ff.collection_select(
:dependency_id, @dependencies, :id, :name,
{ :prompt => 'Select a name' }, #options hash
{ :class => :input_select, #html hash
:id => :input_name,
:size => 1,
:title => I18n.t('Enter a valid name'),
:value => ff.dependency_id } # this does not
work either
)
Now, while I know that ff != dependency it does seem to me counter
intuitive that for each association of model I am unable to directly
address the dependency attributes from within the form constructor.
What is my fundamental misunderstanding with respect to forms_for and
fields_for and their treatment of DBMS rows? How does one obtain a
dependent attribute for display purposes within a forms_for or
fields_for construct?
On Jan 26, 9:20 am, byrnejb <byrn...@harte-lyne.ca> wrote:
>
> Now, while I know that ff != dependency
This should be association rather than dependency. What I am asking
is why, when ff acts in the place of a specific model.association, I
cannot reach model.association.dependency.attribute.
The problem domain requires that associations be created separately
from either the model or the dependency but must be associated to an
extant qualified row in each.
A FormBuilder. The documentation for form_for already tells you this.
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
--
Posted via http://www.ruby-forum.com/.
same as:
array.each do |val|
puts val
end