method
column_methods_hash
v2.3.8 -
Show latest stable
- Class:
ActiveRecord::Base
column_methods_hash(#:nodoc:)public
Returns a hash of all the methods added to query each of the columns in the table with the name of the method as the key and true as the value. This makes it possible to do O(1) lookups in respond_to? to check if a given method for attribute is available.
# File activerecord/lib/active_record/base.rb, line 1326
def column_methods_hash #:nodoc:
@dynamic_methods_hash ||= column_names.inject(Hash.new(false)) do |methods, attr|
attr_name = attr.to_s
methods[attr.to_sym] = attr_name
methods["#{attr}=".to_sym] = attr_name
methods["#{attr}?".to_sym] = attr_name
methods["#{attr}_before_type_cast".to_sym] = attr_name
methods
end
end Related methods
- Instance methods
- ==
- []
- []=
- attribute_for_inspect
- attribute_names
- attribute_present?
- attributes
- attributes=
- attributes_before_type_cast
- becomes
- cache_key
- clone
- column_for_attribute
- connection
- decrement
- decrement!
- delete
- destroy
- destroyed?
- eql?
- freeze
- frozen?
- has_attribute?
- hash
- id
- id=
- id_before_type_cast
- increment
- increment!
- inspect
- new_record?
- quoted_id
- readonly!
- readonly?
- reload
- save
- save!
- to_param
- toggle
- toggle!
- update_attribute
- update_attributes
- update_attributes!
- Class methods
- ===
- abstract_class?
- accessible_attributes
- all
- allow_concurrency
- allow_concurrency=
- attr_accessible
- attr_protected
- attr_readonly
- base_class
- benchmark
- class_name
- column_methods_hash
- column_names
- columns
- columns_hash
- connected?
- connection
- connection_pool
- content_columns
- count_by_sql
- create
- decrement_counter
- delete
- delete_all
- descends_from_active_record?
- destroy
- destroy_all
- establish_connection
- exists?
- find
- find_by_sql
- finder_needs_type_condition?
- first
- full_table_name_prefix
- get_primary_key
- human_attribute_name
- human_name
- increment_counter
- inheritance_column
- inherited
- inspect
- last
- merge_conditions
- mysql_connection
- new
- postgresql_connection
- primary_key
- protected_attributes
- quote_value
- readonly_attributes
- remove_connection
- reset_column_information
- reset_column_information_and_inheritable_attributes_for_all_subclasses
- reset_counters
- reset_primary_key
- reset_sequence_name
- reset_subclasses
- reset_table_name
- respond_to?
- retrieve_connection
- sanitize
- self_and_descendants_from_active_record
- sequence_name
- serialize
- serialized_attributes
- set_inheritance_column
- set_primary_key
- set_sequence_name
- set_table_name
- silence
- sqlite3_connection
- sqlite_connection
- sti_name
- table_exists?
- table_name
- update
- update_all
- update_counters
- verification_timeout
- verification_timeout=
- Protected methods
-
aggregate_mapping -
class_name_of_active_record_descendant -
class_of_active_record_descendant -
compute_type -
current_scoped_methods -
default_scope -
encode_quoted_value -
expand_hash_conditions_for_aggregates -
expand_range_bind_variables -
quote_bound_value -
raise_if_bind_arity_mismatch -
replace_bind_variables -
replace_named_bind_variables -
sanitize_sql_array -
sanitize_sql_for_assignment -
sanitize_sql_for_conditions -
sanitize_sql_hash_for_assignment -
sanitize_sql_hash_for_conditions -
scope -
scoped? -
scoped_methods -
set_readonly_option! -
subclasses -
validate_find_options -
with_exclusive_scope -
with_scope - Private methods
-
add_conditions! -
add_group! -
add_joins! -
add_limit! -
add_lock! -
add_order! -
all_attributes_exists? -
array_of_strings? -
attribute_condition -
construct_attributes_from_arguments -
construct_finder_sql -
default_select -
define_attr_method -
expand_attribute_names_for_aggregates -
expand_id_conditions -
find_every -
find_from_ids -
find_initial -
find_last -
find_one -
find_some -
instantiate -
merge_includes -
merge_joins -
method_missing -
parse_sqlite_config! -
quoted_table_name -
reverse_sql_order -
safe_to_array -
type_condition -
type_name_with_module -
undecorated_table_name -
assign_attributes -
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 -
ensure_proper_type -
execute_callstack_for_multiparameter_attributes -
extract_callstack_for_multiparameter_attributes -
find_parameter_position -
instantiate_time_object -
interpolate_sql -
log_protected_attribute_removal -
object_from_yaml -
quote_columns -
quote_value -
quoted_column_names -
quoted_comma_pair_list -
remove_attributes_protected_from_mass_assignment -
remove_readonly_attributes -
type_cast_attribute_value -
update