Hi, Maybe I could simplify the issue. In input-many tag, how could I do a "repeat" for a "fake-field- context" and restore the context to let the form know the right context to show the input tags ? (avoiding error "DRYML cannot provide the correct form-field name here") It seems that, inside the fake-field-context, this_parent has to be an association but it's not sufficient.
Any idea ? Thanks in advance, Arnaud. On Sep 19, 7:24 pm, Arnaud Doyen <[email protected]> wrote: > Hi all, > > I have some models defined like this: > ParametertableElement > has_many :parametertable_values, :dependent => :destroy, :accessible => > true > has_many :parametertable_columns, :through => :parametertable, :order => > "position" > > ParametertableColumn > has_many :parametertable_values, :dependent => :destroy, :accessible => > true > has_many :parametertable_elements, :through => :parametertable > > ParametertableValue > attr_accessor :value > belongs_to :parametertable_column > belongs_to :parametertable_element > > I want to add a new line in the table, depending on the columns. > Like for any tables, for one column and one element (i.e. line), I have only > one value. > > I succeeded to do the edit screen of the line, modifying the last part of > input-many like this: > <li repeat class="input-many-li #{'record-with-errors' unless > this.errors.empty?}" id="#{param_name_for_this}"> > <error-messages without-heading class="sub-record"/> > <hidden-id-field/> > <div class="input-many-item" param="default"> > <field-list fields="value" skip="&skip"> > <value-label:><name > with="&this_parent.parametertable_column"/></value-label:> > </field-list> > </div> > </li> > > In parametertable_element_controller, I have set this: > auto_actions_for :parametertable, [:new,:create] > > And now, I try to create the new page (for a specified @parametertable) but > I don't succeed to have it working. > For example, something like this in the input-many tag for > ParametertableValue: > > <repeat with="&[email protected]_columns" > if="&this.empty?"> > > <fake-field-context fake-field="&this.id" context="&template" > > > <li class="input-many-li" id="#{param_name_for_this}"> > > <div class="input-many-item" param="default"> > > <field-list fields="value" skip="&skip"> > > <value-label:><name with="&this_parent.parametertable_column" > /></value-label:> > > </field-list> > > </div> > > </li> > > </fake-field-context> > > </repeat> > > Is not working because of the model's fields are all nil (apparently): > > DRYML cannot provide the correct form-field name here (this_field = > "2", this = #<ParametertableValue id: nil, created_at: nil, > updated_at: nil, parametertable_column_id: nil, > parametertable_element_id: nil, value_boolean: nil, value_integer: > nil, value_string: nil, value_text: nil, value_html: nil, > value_parameter: nil>) > > I don't know why to do for that. > Since I don't really understand the concept of "fake-field-context", it's > really hard for me to solve that. > Moreover, I maybe have to set the column_id of ParametertableValue as an > hidden field to make sure it is well linked to the argument and to the > column while saving it. > > Have you any idea of how this could work ? > > Thanks in advance for any help, > Arnaud. -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
