app/controllers/concerns/batch_actions.rb
# Destroys multiple records.
#
# Expects the 'ids' request parameter to be populated with the ids of the
# records to destroy.
#
# Exposes two instance variables to the view:
# * @success_ids - an array (non nil) of record ids for which the operation
#   was a success
# * @failure_ids - an array (non nil) or record ids for which the operation
#   was a failure
Destroys multiple records.
Expects the 'ids' request parameter to be populated with the ids of the
records to destroy.

Exposes two instance variables to the view:
@success_ids - an array (non nil) of record ids for which the operation
was a success
@failure_ids - an array (non nil) or record ids for which the operation
was a failure
Destroys multiple records . Expects the ' ids ' request parameter to be populated with the ids of the records to destroy . Exposes two instance variables to the view : @success_ids - an array ( non nil ) of record ids for which the operation was a success @failure_ids - an array ( non nil ) or record ids for which the operation was a failure
def batch_destroy
    @success_ids = []
    @failure_ids = []
    if (ids = params[:ids])
      ids.each do |id|
        begin
          if (deleted_record = self.class.batch_opts[:model].destroy(id))
            @success_ids << deleted_record.id
          end
        rescue
          @failure_ids << id
        end
      end
    end
    render 'layouts/batch_actions/batch_destroy'
  end
def batch_destroy @success_ids = [ ] @failure_ids = [ ] if ( ids = params [ :ids ] ) ids . each do | id | begin if ( deleted_record = self . class . batch_opts [ :model ] . destroy ( id ) ) @success_ids << deleted_record . id end rescue @failure_ids << id end end end render 'layouts/batch_actions/batch_destroy' end
Destroys multiple records.
Destroys multiple records .