Model.destroy(array of ids) Bug

Hello friends !

Model.destroy(array of ids) gives record not found error in Internet
Explorer.

Sandip R~


Ruby on Rails Developer



www.joshsoftware.com

Sandip,

Are you certain all of the ids are valid?

You could try adding something like this to your controller action
before the destroy is called:

def destroy
@records = Model.all( :conditions => [“id IN (?)”, array])
raise “Not all ids were valid!” unless @records.size == array.size
Model.destroy(array)

end

This will raise an error if the ids are not all valid and you’ll know
to look elsewhere for the root of the problem

Hope that helps?

Gavin

http://handyrailstips.com

Sorry, my mistake !

Actually IE brawser was submitting request twice to delete action.
hence…in second request it was showing record not found exception.

–Sandip R~

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs