Forum: Ruby on Rails undefined method frustration

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2db3a32b41505fca3f96ad08d4865f0e?d=identicon&s=25 jeff.blasius (Guest)
on 2005-12-09 20:43
(Received via mailing list)
Hello Everyone,
I just don't understand why I can't do this. I have a table with one
column set as serialize. In the form I want three check boxes with two
or more text fields each, so that when the check boxes are selected
the text fields are saved in the serialized column. Something like:
validation2: warning
                 error

validation4: warning
                 error

The validation<id> would then be removed according to the checkboxes.
Does this seem possible? What do I need to do to resolve the undefined
method error?

Is there some documentation on this??
Thanks,
                  jeff

Here is what I'm doing:
View:
<input type="checkbox" name="validation_ids[]" value="1" <%if
@attradio.validations[1] %>checked="checked"<% end %> >Must select one
<label for="attradio_warning1">Warning</label><br/>
<%= text_field 'attradio', 'warning1' %>

Controller:
  def edit
    @attradio = Attradio.find(params[:id])
    render(:layout => false)
  end

  def update
    @attradio = Attradio.find(params[:id])
    @attglobal = @item.attglobal
    @attradio.validations = params[:warning1] if params[:validation_ids]
== '1'
    if @attradio.update_attributes(params[:attradio])
      flash[:notice] = 'Attradio was successfully updated.'
      redirect_to :controller => 'items', :action => 'edit_form', :id
=> @attradio.item_id
    else
      render :action => 'edit'
    end
  end
This topic is locked and can not be replied to.