method
delete_all
v1.0.0 -
Show latest stable
- Class:
ActiveRecord::Base
delete_all(conditions = nil)public
Deletes all the records that match the condition without instantiating the objects first (and hence not calling the destroy method). Example:
Post.delete_all "person_id = 5 AND (category = 'Something' OR category = 'Else')"
# File activerecord/lib/active_record/base.rb, line 499
def delete_all(conditions = nil)
sql = "DELETE FROM #{table_name} "
add_conditions!(sql, conditions)
connection.delete(sql, "#{name} Delete all")
end Related methods
- Instance methods
- ==
- []
- []=
- attribute_names
- attribute_present?
- attributes
- attributes=
- attributes_before_type_cast
- clone
- column_for_attribute
- connection
- decrement
- decrement!
- destroy
- eql?
- freeze
- frozen?
- has_attribute?
- hash
- id
- id=
- increment
- increment!
- new_record?
- readonly!
- readonly?
- reload
- respond_to?
- save
- to_param
- toggle
- toggle!
- update_attribute
- update_attributes
- Class methods
- ===
- attr_accessible
- attr_protected
- benchmark
- clear_connection_cache!
- column_methods_hash
- column_names
- columns
- columns_hash
- connected?
- connection
- connection=
- connection=
- content_columns
- count
- count_by_sql
- create
- decrement_counter
- delete
- delete_all
- destroy
- destroy_all
- establish_connection
- exists?
- find
- find_by_sql
- increment_counter
- inheritance_column
- new
- primary_key
- read_methods
- remove_connection
- reset_column_information
- reset_primary_key
- reset_sequence_name
- reset_subclasses
- reset_table_name
- sequence_name
- serialize
- serialized_attributes
- set_inheritance_column
- set_primary_key
- set_sequence_name
- set_table_name
- silence
- table_exists?
- table_name
- threaded_connections
- threaded_connections=
- update
- update_all
- with_scope
- Protected methods
-
class_name_of_active_record_descendant -
compute_type -
encode_quoted_value -
extract_options_from_args! -
quote_bound_value -
raise_if_bind_arity_mismatch -
replace_bind_variables -
replace_named_bind_variables -
sanitize_sql -
scope -
scoped? -
scoped_methods -
scoped_methods= -
subclasses -
validate_find_options - Private methods
-
add_conditions! -
add_joins! -
add_limit! -
all_attributes_exists? -
attribute_condition -
construct_attributes_from_arguments -
construct_conditions_from_arguments -
construct_finder_sql -
define_attr_method -
determine_finder -
extract_attribute_names_from_match -
instantiate -
method_missing -
parse_config! -
type_condition -
type_name_with_module -
undecorated_table_name -
assign_multiparameter_attributes -
attributes_from_column_definition -
attributes_protected_by_default -
attributes_with_quotes -
clone_attribute_value -
clone_attributes -
comma_pair_list -
convert_number_column_value -
create -
create_or_update -
define_read_method -
define_read_methods -
ensure_proper_type -
execute_callstack_for_multiparameter_attributes -
extract_callstack_for_multiparameter_attributes -
find_parameter_position -
interpolate_sql -
method_missing -
object_from_yaml -
query_attribute -
quote -
quote_columns -
quoted_column_names -
quoted_comma_pair_list -
read_attribute -
read_attribute_before_type_cast -
remove_attributes_protected_from_mass_assignment -
type_cast_attribute_value -
unserializable_attribute? -
unserialize_attribute -
update -
write_attribute