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