I have a form which is used to update multiple records (of the same
model) at one time, which it successfully does, but when I try to add
vaildation to the form, it seems to be ignored.
Code from the update method of my controller:
def update
SurvCamera.transaction do
SurvCamera.update(params[:surv_camera].keys,
params[:surv_camera].values )
end
flash[:notice] = "Cameras successfully updated."
redirect_to :action => 'show', :id => params[:id]
rescue ActiveRecord::RecordInvalid
render :action => 'edit'
end
In the model, I have the following to validate that "location" field is
not empty:
validates_presence_of :location
Like I mentioned...the updates work fine, however when I try to edit
records and leave location empty, it still attempts to save the record
w/out first running validation. Any suggestions?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en.