method
column_methods_hash
rails latest stable - Class:
ActiveRecord::Base
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v3.1.0) is shown here.
column_methods_hash()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 734
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
- <=>
- ==
- assign_attributes
- attribute_for_inspect
- attribute_names
- attribute_present?
- attributes
- attributes=
- cache_key
- column_for_attribute
- connection
- dup
- encode_with
- eql?
- freeze
- frozen?
- has_attribute?
- hash
- init_with
- initialize_dup
- inspect
- quoted_id
- readonly!
- readonly?
- to_param
- Class methods
- ===
- abstract_class?
- arel_engine
- arel_table
- attr_readonly
- attribute_method?
- attribute_names
- base_class
- before_remove_const
- clear_active_connections!
- clear_cache!
- column_defaults
- column_methods_hash
- column_names
- columns
- columns_hash
- configurations
- connected?
- connection
- connection_config
- connection_handler
- connection_pool
- content_columns
- count_by_sql
- create
- default_timezone
- descends_from_active_record?
- establish_connection
- find_by_sql
- finder_needs_type_condition?
- full_table_name_prefix
- i18n_scope
- inheritance_column
- inheritance_column=
- inspect
- instantiate
- logger
- lookup_ancestors
- mysql2_connection
- mysql_connection
- new
- pluralize_table_names
- postgresql_connection
- primary_key_prefix_type
- quote_value
- quoted_table_name
- readonly_attributes
- remove_connection
- reset_column_information
- reset_sequence_name
- reset_table_name
- respond_to?
- retrieve_connection
- sanitize
- schema_format
- sequence_name
- sequence_name=
- serialize
- set_inheritance_column
- set_sequence_name
- set_table_name
- sqlite3_connection
- sti_name
- symbolized_base_class
- symbolized_sti_name
- table_exists?
- table_name
- table_name=
- table_name_prefix
- table_name_suffix
- timestamped_migrations
- unscoped
- Protected methods
-
aggregate_mapping -
build_default_scope -
class_of_active_record_descendant -
compute_type -
current_scope -
current_scope= -
default_scope -
encode_quoted_value -
evaluate_default_scope -
expand_hash_conditions_for_aggregates -
expand_range_bind_variables -
ignore_default_scope= -
ignore_default_scope? -
quote_bound_value -
raise_if_bind_arity_mismatch -
replace_bind_variables -
replace_named_bind_variables -
sanitize_conditions -
sanitize_sql -
sanitize_sql_array -
sanitize_sql_for_assignment -
sanitize_sql_for_conditions -
sanitize_sql_hash -
sanitize_sql_hash_for_assignment -
sanitize_sql_hash_for_conditions -
with_exclusive_scope -
with_scope -
clone_attribute_value -
clone_attributes -
mass_assignment_options -
mass_assignment_role - Private methods
-
all_attributes_exists? -
attributes_protected_by_default -
compute_table_name -
construct_finder_arel -
expand_attribute_names_for_aggregates -
find_sti_class -
method_missing -
relation -
type_condition -
undecorated_table_name -
arel_attributes_values -
assign_multiparameter_attributes -
clear_timestamp_attributes -
comma_pair_list -
convert_number_column_value -
ensure_proper_type -
execute_callstack_for_multiparameter_attributes -
extract_callstack_for_multiparameter_attributes -
extract_max_param_for_multiparameter_attributes -
find_parameter_position -
instantiate_time_object -
populate_with_current_scope_attributes -
quote_columns -
quote_value -
quoted_comma_pair_list -
read_date_parameter_value -
read_other_parameter_value -
read_time_parameter_value -
read_value_from_parameter -
set_serialized_attributes -
to_ary -
type_cast_attribute_value