new

- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (0)
- 2.0.3 (0)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.2 (0)
- 2.3.8 (0)
- 3.0.0 (0)
- 3.0.9 (0)
- 3.1.0 (23)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- What's this?
Related methods
- Class methods (218)
-
=== (<= v3.2.13)
-
abstract_class? (<= v3.1.0)
-
accessible_attributes (<= v2.3.8)
-
active_connection_name (<= v2.1.0)
-
add_conditions!
(<= v2.3.8)
-
add_group!
(<= v2.3.8)
-
add_joins!
(<= v2.3.8)
-
add_limit!
(<= v2.3.8)
-
add_lock!
(<= v2.3.8)
-
add_order!
(<= v2.3.8)
-
aggregate_mapping
(<= v3.1.0)
-
all (<= v2.3.8)
-
all_attributes_exists?
(<= v3.1.0)
-
allow_concurrency (<= v2.3.8)
-
allow_concurrency= (<= v2.3.8)
-
arel_engine (<= v3.2.13)
-
arel_table (<= v3.2.13)
-
array_of_strings?
(<= v2.3.8)
-
attr_accessible (<= v2.3.8)
-
attribute_condition
(<= v2.3.8)
-
attribute_method? (<= v3.1.0)
-
attribute_names (<= v3.1.0)
-
attributes_protected_by_def...
(<= v3.1.0)
-
attr_protected (<= v2.3.8)
-
attr_readonly (<= v3.1.0)
-
base_class (<= v3.1.0)
-
before_remove_const (<= v3.1.0)
-
benchmark (<= v2.3.8)
-
build_default_scope
(<= v3.1.0)
-
class_name (<= v2.3.8)
-
class_name_of_active_record...
(<= v2.3.8)
-
class_of_active_record_desc...
(<= v3.1.0)
-
clear_active_connection_name (<= v2.1.0)
-
clear_active_connections! (<= v3.2.13)
-
clear_all_cached_connections!
(<= v2.1.0)
-
clear_cache! (<= v3.1.0)
-
clear_connection_cache! (<= v1.0.0)
-
clear_reloadable_connections! (<= v2.1.0)
-
colorize_logging (<= v3.0.9)
-
colorize_logging= (<= v3.0.9)
-
column_defaults (<= v3.1.0)
-
column_methods_hash (<= v3.1.0)
-
column_names (<= v3.1.0)
-
columns (<= v3.1.0)
-
columns_hash (<= v3.1.0)
-
compute_table_name
(<= v3.1.0)
-
compute_type
(<= v3.1.0)
-
configurations (<= v3.2.13)
-
connected? (<= v3.2.13)
-
connection (<= v3.2.13)
-
connection= (<= v2.1.0)
-
connection_config (<= v3.2.13)
-
connection_handler (<= v3.2.13)
-
connection_id (<= v3.2.13)
-
connection_id= (<= v3.2.13)
-
connection_pool (<= v3.2.13)
-
construct_attributes_from_a...
(<= v3.0.9)
-
construct_conditions_from_a...
(<= v1.1.6)
-
construct_finder_arel
(<= v3.1.0)
-
construct_finder_sql
(<= v2.3.8)
-
content_columns (<= v3.1.0)
-
count (<= v1.0.0)
-
count_by_sql (<= v3.1.0)
-
create (<= v3.1.0)
-
current_scope
(<= v3.1.0)
-
current_scope=
(<= v3.1.0)
-
current_scoped_methods
(<= v3.0.9)
-
decrement_counter (<= v2.3.8)
-
default_scope
(<= v3.1.0)
-
default_select
(<= v2.3.8)
-
default_timezone (<= v3.2.13)
-
define_attr_method
(<= v2.3.8)
-
delete (<= v2.3.8)
-
delete_all (<= v2.3.8)
-
descends_from_active_record? (<= v3.1.0)
-
destroy (<= v2.3.8)
-
destroy_all (<= v2.3.8)
-
determine_deprecated_finder
(<= v1.2.6)
-
determine_finder
(<= v2.1.0)
-
determine_instantiator
(<= v2.1.0)
-
encode_quoted_value
(<= v3.1.0)
-
establish_connection (<= v3.2.13)
-
evaluate_default_scope
(<= v3.1.0)
-
exists? (<= v2.3.8)
-
expand_attribute_names_for_...
(<= v3.1.0)
-
expand_hash_conditions_for_...
(<= v3.1.0)
-
expand_id_conditions
(<= v2.3.8)
-
expand_range_bind_variables
(<= v3.1.0)
-
extract_attribute_names_fro...
(<= v2.1.0)
-
extract_options_from_args!
(<= v1.0.0)
-
find (<= v2.3.8)
-
find_by_sql (<= v3.1.0)
-
finder_needs_type_condition? (<= v3.1.0)
-
find_every
(<= v2.3.8)
-
find_from_ids
(<= v2.3.8)
-
find_initial
(<= v2.3.8)
-
find_last
(<= v2.3.8)
-
find_one
(<= v2.3.8)
-
find_some
(<= v2.3.8)
-
find_sti_class
(<= v3.1.0)
-
first (<= v2.3.8)
-
full_table_name_prefix (<= v3.1.0)
-
generated_feature_methods (<= v3.2.13)
-
get_primary_key (<= v2.3.8)
-
human_attribute_name (<= v2.3.8)
-
human_name (<= v2.3.8)
-
i18n_scope (<= v3.1.0)
-
ignore_default_scope=
(<= v3.1.0)
-
ignore_default_scope?
(<= v3.1.0)
-
increment_counter (<= v2.3.8)
-
inheritance_column (<= v3.1.0)
-
inheritance_column= (<= v3.1.0)
-
inherited (<= v3.2.13)
-
initialize_generated_modules (<= v3.2.13)
-
inspect (<= v3.2.13)
-
instantiate (<= v3.1.0)
-
last (<= v2.3.8)
-
log_connections (<= v2.1.0)
-
logger (<= v3.2.13)
-
lookup_ancestors (<= v3.1.0)
-
matches_dynamic_finder?
(<= v2.1.0)
-
matches_dynamic_finder_with...
(<= v2.1.0)
-
merge_conditions (<= v2.3.8)
-
merge_includes
(<= v2.3.8)
-
merge_joins
(<= v2.3.8)
-
method_missing
(<= v3.1.0)
-
mysql2_connection (<= v3.2.13)
-
mysql_connection (<= v3.2.13)
-
new (<= v3.2.13)
-
parse_config!
(<= v1.2.6)
-
parse_sqlite_config!
(<= v2.3.8)
-
pluralize_table_names (<= v3.1.0)
-
postgresql_connection (<= v3.2.13)
-
primary_key (<= v2.3.8)
-
primary_key_prefix_type (<= v3.1.0)
-
protected_attributes (<= v2.3.8)
-
quote_bound_value
(<= v3.1.0)
-
quoted_table_name (<= v3.1.0)
-
quote_value (<= v3.1.0)
-
raise_if_bind_arity_mismatch
(<= v3.1.0)
-
read_methods (<= v1.0.0)
-
readonly_attributes (<= v3.1.0)
-
relation
(<= v3.2.13)
-
remove_connection (<= v3.2.13)
-
remove_stale_cached_threads!
(<= v2.1.0)
-
replace_bind_variables
(<= v3.1.0)
-
replace_named_bind_variables
(<= v3.1.0)
-
require_mysql (<= v2.1.0)
-
reset_column_information (<= v3.1.0)
-
reset_column_information_an... (<= v3.0.9)
-
reset_counters (<= v2.3.8)
-
reset_primary_key (<= v2.3.8)
-
reset_scoped_methods
(<= v3.0.9)
-
reset_sequence_name (<= v3.1.0)
-
reset_subclasses (<= v3.0.9)
-
reset_table_name (<= v3.1.0)
-
respond_to? (<= v3.1.0)
-
retrieve_connection (<= v3.2.13)
-
reverse_sql_order
(<= v2.3.8)
-
safe_to_array
(<= v2.3.8)
-
sanitize (<= v3.1.0)
-
sanitize_conditions
(<= v3.1.0)
-
sanitize_sql
(<= v3.1.0)
-
sanitize_sql_array
(<= v3.1.0)
-
sanitize_sql_for_assignment
(<= v3.1.0)
-
sanitize_sql_for_conditions
(<= v3.1.0)
-
sanitize_sql_hash
(<= v3.1.0)
-
sanitize_sql_hash_for_assig...
(<= v3.1.0)
-
sanitize_sql_hash_for_condi...
(<= v3.1.0)
-
schema_format (<= v3.2.13)
-
scope
(<= v2.3.8)
-
scoped?
(<= v2.3.8)
-
scoped_methods (<= v3.0.9)
-
scoped_methods=
(<= v1.0.0)
-
self_and_descendants_from_a... (<= v2.3.8)
-
self_and_descendents_from_a... (<= v2.2.1)
-
sequence_name (<= v3.1.0)
-
sequence_name= (<= v3.1.0)
-
serialize (<= v3.1.0)
-
serialized_attributes (<= v3.0.9)
-
set_inheritance_column (<= v3.1.0)
-
set_locking_column (<= v1.1.6)
-
set_primary_key (<= v2.3.8)
-
set_readonly_option!
(<= v2.3.8)
-
set_sequence_name (<= v3.1.0)
-
set_table_name (<= v3.1.0)
-
silence (<= v2.3.8)
-
single_threaded_active_conn... (<= v2.1.0)
-
single_threaded_scoped_methods
(<= v2.1.0)
-
sqlite3_connection (<= v3.2.13)
-
sqlite_connection (<= v2.3.8)
-
sti_name (<= v3.1.0)
-
subclasses (<= v3.0.9)
-
symbolized_base_class (<= v3.1.0)
-
symbolized_sti_name (<= v3.1.0)
-
table_exists? (<= v3.1.0)
-
table_name (<= v3.1.0)
-
table_name= (<= v3.1.0)
-
table_name_prefix (<= v3.1.0)
-
table_name_suffix (<= v3.1.0)
-
threaded_connections (<= v1.0.0)
-
threaded_connections= (<= v1.0.0)
-
thread_safe_active_connections (<= v2.1.0)
-
thread_safe_scoped_methods
(<= v2.1.0)
-
timestamped_migrations (<= v3.2.13)
-
type_condition
(<= v3.1.0)
-
type_name_with_module
(<= v2.3.8)
-
undecorated_table_name
(<= v3.1.0)
-
unscoped (<= v3.1.0)
-
update (<= v2.3.8)
-
update_all (<= v2.3.8)
-
update_counters (<= v2.3.8)
-
validate_find_options
(<= v2.3.8)
-
verification_timeout (<= v2.3.8)
-
verification_timeout= (<= v2.3.8)
-
verify_active_connections! (<= v2.1.0)
-
with_exclusive_scope
(<= v3.1.0)
-
with_scope
(<= v3.1.0)
- Instance methods (107)
-
<=> (<= v3.2.13)
-
== (<= v3.2.13)
-
[] (<= v3.0.9)
-
[]= (<= v3.0.9)
-
arel_attributes_values
(<= v3.1.0)
-
assign_attributes (<= v3.1.0)
-
assign_multiparameter_attri...
(<= v3.1.0)
-
attribute_for_inspect (<= v3.1.0)
-
attribute_names (<= v3.1.0)
-
attribute_present? (<= v3.1.0)
-
attributes (<= v3.1.0)
-
attributes= (<= v3.1.0)
-
attributes_before_type_cast (<= v2.3.8)
-
attributes_from_column_defi...
(<= v2.3.8)
-
attributes_protected_by_def...
(<= v2.3.8)
-
attributes_with_quotes
(<= v2.3.8)
-
becomes (<= v2.3.8)
-
cache_key (<= v3.1.0)
-
clear_timestamp_attributes
(<= v3.1.0)
-
clone (<= v2.3.8)
-
clone_attributes
(<= v3.1.0)
-
clone_attribute_value
(<= v3.1.0)
-
column_for_attribute (<= v3.1.0)
-
comma_pair_list
(<= v3.1.0)
-
connection (<= v3.2.13)
-
convert_number_column_value
(<= v3.1.0)
-
create
(<= v2.3.8)
-
create_or_update
(<= v2.3.8)
-
decrement (<= v2.3.8)
-
decrement! (<= v2.3.8)
-
define_question_method
(<= v1.2.6)
-
define_read_method
(<= v1.2.6)
-
define_read_method_for_seri...
(<= v1.2.6)
-
define_read_methods
(<= v1.2.6)
-
delete (<= v2.3.8)
-
destroy (<= v2.3.8)
-
destroyed? (<= v2.3.8)
-
dup (<= v3.2.13)
-
encode_with (<= v3.2.13)
-
ensure_proper_type
(<= v3.1.0)
-
eql? (<= v3.2.13)
-
evaluate_read_method
(<= v1.2.6)
-
execute_callstack_for_multi...
(<= v3.1.0)
-
extract_callstack_for_multi...
(<= v3.1.0)
-
extract_max_param_for_multi...
(<= v3.1.0)
-
find_parameter_position
(<= v3.1.0)
-
freeze (<= v3.2.13)
-
frozen? (<= v3.2.13)
-
has_attribute? (<= v3.1.0)
-
hash (<= v3.2.13)
-
id (<= v2.3.8)
-
id= (<= v2.3.8)
-
id_before_type_cast (<= v2.3.8)
-
increment (<= v2.3.8)
-
increment! (<= v2.3.8)
-
initialize_copy (<= v3.0.9)
-
initialize_dup (<= v3.2.13)
-
init_with (<= v3.2.13)
-
inspect (<= v3.2.13)
-
instantiate_time_object
(<= v3.1.0)
-
interpolate_and_sanitize_sql
(<= v3.0.9)
-
interpolate_sanitized_sql
(<= v3.0.9)
-
interpolate_sql
(<= v3.0.0)
-
log_protected_attribute_rem...
(<= v2.3.8)
-
mass_assignment_options
(<= v3.1.0)
-
mass_assignment_role
(<= v3.1.0)
-
method_missing
(<= v1.2.6)
-
new_record? (<= v2.3.8)
-
object_from_yaml
(<= v3.0.9)
-
populate_with_current_scope...
(<= v3.1.0)
-
query_attribute
(<= v1.2.6)
-
quote
(<= v1.2.6)
-
quote_columns
(<= v3.1.0)
-
quoted_column_names
(<= v2.3.8)
-
quoted_comma_pair_list
(<= v3.1.0)
-
quoted_id (<= v3.1.0)
-
quote_value
(<= v3.1.0)
-
read_attribute
(<= v1.2.6)
-
read_attribute_before_type_...
(<= v1.2.6)
-
read_date_parameter_value
(<= v3.1.0)
-
readonly! (<= v3.2.13)
-
readonly? (<= v3.2.13)
-
read_other_parameter_value
(<= v3.1.0)
-
read_time_parameter_value
(<= v3.1.0)
-
read_value_from_parameter
(<= v3.1.0)
-
reload (<= v2.3.8)
-
remove_attributes_protected...
(<= v2.3.8)
-
remove_readonly_attributes
(<= v2.3.8)
-
respond_to? (<= v1.2.6)
-
save (<= v2.3.8)
-
save! (<= v2.3.8)
-
set_serialized_attributes
(<= v3.1.0)
-
to_ary
(<= v3.2.13)
-
toggle (<= v2.3.8)
-
toggle! (<= v2.3.8)
-
to_param (<= v3.1.0)
-
to_xml (<= v1.1.6)
-
to_yaml (<= v3.2.13)
-
type_cast_attribute_value
(<= v3.1.0)
-
unserializable_attribute?
(<= v1.2.6)
-
unserialize_attribute
(<= v1.2.6)
-
update
(<= v2.3.8)
-
update_attribute (<= v2.3.8)
-
update_attributes (<= v2.3.8)
-
update_attributes! (<= v2.3.8)
-
write_attribute
(<= v1.2.6)
-
yaml_initialize (<= v3.2.13)
= private
= protected
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v3.2.13) is shown here.
These similar methods exist in v5.2.3:
- Mime::Type#new
- ActiveSupport::Multibyte::Chars#new
- ActiveSupport::Cache::Store#new
- ActiveRecord::MultiparameterAssignmentErrors#new
- ActiveRecord::Reflection::MacroReflection#new
- ActionView::TestCase::TestController#new
- ActiveRecord::AttributeAssignmentError#new
- ActiveSupport::TimeWithZone#new
- ActiveSupport::Cache::MemCacheStore#new
- ActiveSupport::Cache::MemoryStore#new
- ActiveSupport::Cache::FileStore#new
- ActiveRecord::ConnectionAdapters::TableDefinition#new
- ActionMailer::NonInferrableMailerError#new
- SourceAnnotationExtractor#new
- ActiveSupport::Callbacks::Callback#new
- ActiveRecord::ConnectionAdapters::Table#new
- ActiveRecord::RecordInvalid#new
- ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder#new
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#new
- CodeStatistics#new
- ActionMailer::Base#new
- ActionController::MethodNotAllowed#new
- ActionController::RoutingError#new
- ActionController::TestSession#new
- ActionController::SessionOverflowError#new
- Mime::Type::AcceptItem#new
- ActionView::Template#new
- ActionView::Helpers::FormBuilder#new
- ActionView::Helpers::TextHelper::Cycle#new
- ActiveRecord::Migrator#new
- ActiveRecord::UnknownMigrationVersionError#new
- ActiveRecord::HasManyThroughAssociationPointlessSourceTypeError#new
- ActiveRecord::DuplicateMigrationNameError#new
- ActiveRecord::IllegalMigrationNameError#new
- ActiveRecord::SchemaDumper#new
- ActiveRecord::DuplicateMigrationVersionError#new
- ActiveRecord::HasManyThroughAssociationNotFoundError#new
- ActiveRecord::EagerLoadPolymorphicError#new
- ActiveRecord::HasManyThroughSourceAssociationNotFoundError#new
- ActiveRecord::Associations::HasManyThroughAssociation#new
- ActiveRecord::ConnectionAdapters::AbstractAdapter#new
- ActiveRecord::ConnectionAdapters::PostgreSQLColumn#new
- ActiveSupport::OptionMerger#new
- ActiveSupport::Duration#new
- ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy#new
- ActionView::MissingTemplate#new
- ActionView::PathSet#new
- ActionView::Helpers::DateTimeSelector#new
- ActionView::Helpers::AtomFeedHelper::AtomBuilder#new
- ActiveRecord::ConnectionAdapters::ConnectionPool#new
- ActiveRecord::ConnectionAdapters::ConnectionHandler#new
- ActiveSupport::TimeZone#new
- ActiveSupport::Inflector::Inflections#new
- ActiveSupport::Deprecation::DeprecatedConstantProxy#new
- ActiveSupport::Deprecation::DeprecatedObjectProxy#new
- Rails::Rack::Logger#new
- ActionController::MiddlewareStack::Middleware#new
- ActiveSupport::MessageVerifier#new
- ActiveSupport::MessageEncryptor#new
- ActiveSupport::BacktraceCleaner#new
- Rails::BacktraceCleaner#new
- ActionController::TestRequest#new
- ActiveRecord::InverseOfAssociationNotFoundError#new
- ActionMailer::Collector#new
- ActionController::Metal#new
- ActionController::MimeResponds::Collector#new
- ActionView::LookupContext#new
- ActionView::Template::Text#new
- ActionView::Template::Error#new
- ActionView::FileSystemResolver#new
- ActionView::Resolver#new
- ActionView::Helpers::NumberHelper::InvalidNumberError#new
- AbstractController::DoubleRenderError#new
- ActionDispatch::MiddlewareStack::Middleware#new
- ActionDispatch::MiddlewareStack#new
- ActionDispatch::ShowExceptions#new
- ActionDispatch::Flash::FlashHash#new
- ActionDispatch::Flash::FlashNow#new
- ActionDispatch::Flash#new
- ActionDispatch::RemoteIp#new
- ActionDispatch::Static#new
- ActionDispatch::Callbacks#new
- ActionDispatch::Cookies::CookieJar#new
- ActionDispatch::Cookies#new
- ActionDispatch::Request#new
- ActionDispatch::Integration::Session#new
- ActionDispatch::Session::MemCacheStore#new
- ActionDispatch::Session::CookieStore#new
- ActionDispatch::Http::Headers#new
- ActionDispatch::Routing::Mapper::Mapping#new
- ActionDispatch::Routing::Mapper::Constraints#new
- ActionDispatch::Routing::Mapper::Scoping#new
- ActiveModel::Validator#new
- ActiveModel::Name#new
- ActiveModel::Errors#new
- ActiveModel::EachValidator#new
- ActiveModel::BlockValidator#new
- ActiveModel::AttributeMethods::ClassMethods::AttributeMethodMatcher#new
- ActiveModel::Validations::LengthValidator#new
- ActiveModel::Validations::AcceptanceValidator#new
- ActiveRecord::Relation#new
- ActiveRecord::Relation#new
- ActiveRecord::DeleteRestrictionError#new
- ActiveRecord::PredicateBuilder#new
- ActiveRecord::Reflection::AssociationReflection#new
- ActiveRecord::Validations::UniquenessValidator#new
- ActiveSupport::InheritableOptions#new
- ActiveSupport::HashWithIndifferentAccess#new
- ActiveSupport::Notifications::Fanout#new
- ActiveSupport::Notifications::Event#new
- ActiveSupport::Notifications::Instrumenter#new
- ActiveSupport::Dependencies::WatchStack#new
- Rails::Railtie::Configuration#new
- Rails::Engine::Configuration#new
- Rails::DBConsole#new
- Rails::Application::Configuration#new
- Rails::Console#new
- Rails::Server#new
- Rails::Paths::Root#new
- Rails::Paths::Path#new
- Rails::Initializable::Initializer#new
- Rails::Generators::AppGenerator#new
- Rails::Generators::NamedBase#new
- Rails::Generators::ActiveModel#new
- Rails::Generators::GeneratedAttribute#new
- Rails::Generators::ResourceHelpers#new
- Rails::Configuration::Generators#new
- Rails::Configuration::MiddlewareStackProxy#new
- Rails::ActionMethods#new
- ActionView::WrongEncodingError#new
- ActionView::FixtureResolver#new
- ActionView::OutputBuffer#new
- ActionDispatch::Http::ParameterFilter#new
- ActiveSupport::LogSubscriber::TestHelper::MockLogger#new
- ActiveSupport::FileUpdateChecker#new
- ActiveSupport::Multibyte::Unicode::UnicodeDatabase#new
- ActiveSupport::Cache::Entry#new
- ActiveSupport::Cache::Strategy::LocalCache::LocalStore#new
- ActiveSupport::Deprecation::DeprecationProxy#new
- ActionDispatch::Http::UploadedFile#new
- ActionView::TestCase::Behavior::ClassMethods#new
- ActiveSupport::Gzip::Stream#new
- ActiveSupport::Multibyte::Unicode::DatabaseGenerator#new
- ActionDispatch::FileHandler#new
- ActionDispatch::RailsEntityStore#new
- ActionDispatch::RailsMetaStore#new
- ActionDispatch::Response#new
- ActionDispatch::Routing::RoutesProxy#new
- ActionView::AbstractRenderer#new
- ActionView::OutputFlow#new
- ActionView::PartialRenderer#new
- ActionView::PathResolver#new
- ActionView::Renderer#new
- ActionView::Resolver::Path#new
- ActionView::StreamingBuffer#new
- ActionView::StreamingFlow#new
- ActionView::StreamingTemplateRenderer::Body#new
- ActiveRecord::Associations::AliasTracker#new
- ActiveRecord::Associations::Association#new
- ActiveRecord::Associations::AssociationScope#new
- ActiveRecord::Associations::CollectionProxy#new
- ActiveRecord::Associations::JoinDependency#new
- ActiveRecord::Associations::JoinDependency::JoinAssociation#new
- ActiveRecord::Associations::JoinDependency::JoinPart#new
- ActiveRecord::Associations::Preloader::Association#new
- ActiveRecord::ConnectionAdapters::Mysql2Adapter#new
- ActiveRecord::Fixture#new
- ActiveRecord::HasManyThroughAssociationPolymorphicSourceError#new
- ActiveRecord::HasManyThroughAssociationPolymorphicThroughError#new
- ActiveRecord::HasOneThroughCantAssociateThroughCollection#new
- ActiveRecord::Migration#new
- ActiveRecord::Migration::CommandRecorder#new
- ActiveRecord::Result#new
- ActiveSupport::Cache::Strategy::LocalCache::Middleware#new
- ActiveSupport::Cache::Strategy::LocalCache::Middleware#new
- ActiveSupport::Dependencies::ClassCache#new
- ActiveSupport::SafeBuffer#new
- ActiveSupport::SafeBuffer::SafeConcatError#new
- Build#new
- Rails::Application::RoutesReloader#new
- Rails::Engine::Railties#new
- Rails::Generators::AppBase#new
- ActionDispatch::Routing::UrlFor#new
- ActionDispatch::Session::Compatibility#new
- ActionDispatch::DebugExceptions#new
- ActionDispatch::ExceptionWrapper#new
- ActionDispatch::PublicExceptions#new
- ActionDispatch::RemoteIp::GetIp#new
- ActionDispatch::RequestId#new
- ActionDispatch::Routing::Redirect#new
- ActionDispatch::Session::CacheStore#new
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::StatementPool#new
- ActiveRecord::ConnectionAdapters::SchemaCache#new
- ActiveRecord::ConnectionAdapters::StatementPool#new
- ActiveRecord::StaleObjectError#new
- ActiveRecord::UnknownPrimaryKey#new
- ActiveSupport::TaggedLogging#new
- Rails::Application#new
- ActionController::BadRequest#new
- ActionController::Live::Buffer#new
- ActionController::ParameterMissing#new
- ActionController::Parameters#new
- ActionController::ParamsWrapper::Options#new
- ActionController::RequestForgeryProtection::ProtectionMethods::Exception#new
- ActionController::RequestForgeryProtection::ProtectionMethods::NullSession#new
- ActionController::RequestForgeryProtection::ProtectionMethods::NullSession::NullSessionHash#new
- ActionController::RequestForgeryProtection::ProtectionMethods::ResetSession#new
- ActionController::UnpermittedParameters#new
- ActionDispatch::Http::ParameterFilter::CompiledFilter#new
- ActionDispatch::Journey::GTG::Builder#new
- ActionDispatch::Journey::GTG::MatchData#new
- ActionDispatch::Journey::GTG::Simulator#new
- ActionDispatch::Journey::GTG::TransitionTable#new
- ActionDispatch::Journey::NFA::Builder#new
- ActionDispatch::Journey::NFA::MatchData#new
- ActionDispatch::Journey::NFA::Simulator#new
- ActionDispatch::Journey::NFA::TransitionTable#new
- ActionDispatch::Journey::NFA::Visitor#new
- ActionDispatch::Journey::Nodes::Binary#new
- ActionDispatch::Journey::Nodes::Dummy#new
- ActionDispatch::Journey::Nodes::Node#new
- ActionDispatch::Journey::Nodes::Or#new
- ActionDispatch::Journey::Nodes::Symbol#new
- ActionDispatch::Journey::Path::Pattern#new
- ActionDispatch::Journey::Path::Pattern::AnchoredRegexp#new
- ActionDispatch::Journey::Path::Pattern::MatchData#new
- ActionDispatch::Journey::Router#new
- ActionDispatch::Journey::Routes#new
- ActionDispatch::Journey::Scanner#new
- ActionDispatch::Request::Session#new
- ActionDispatch::Request::Session::Options#new
- ActionDispatch::Response::Buffer#new
- ActionDispatch::Routing::ConsoleFormatter#new
- ActionDispatch::Routing::HtmlTableFormatter#new
- ActionDispatch::Routing::RoutesInspector#new
- ActionDispatch::Session::SessionRestoreError#new
- ActionView::DependencyTracker::ERBTracker#new
- ActionView::Helpers::Tags::Base#new
- ActionView::Helpers::Tags::CheckBox#new
- ActionView::Helpers::Tags::CollectionHelpers::Builder#new
- ActionView::Helpers::Tags::CollectionSelect#new
- ActionView::Helpers::Tags::DateSelect#new
- ActionView::Helpers::Tags::GroupedCollectionSelect#new
- ActionView::Helpers::Tags::Label#new
- ActionView::Helpers::Tags::RadioButton#new
- ActionView::Helpers::Tags::Select#new
- ActionView::Helpers::Tags::TimeZoneSelect#new
- ActionView::Resolver::Cache#new
- ActionView::Resolver::Cache::SmallCache#new
- ActionView::Template::Types::Type#new
- ActionView::TestCase::Behavior::RenderedViewsCollection#new
- ActiveRecord::AssociationRelation#new
- ActiveRecord::Associations::CollectionProxy#new
- ActiveRecord::Coders::YAMLColumn#new
- ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation#new
- ActiveRecord::ConnectionAdapters::AlterTable#new
- ActiveRecord::ConnectionAdapters::ConnectionPool::Queue#new
- ActiveRecord::ConnectionAdapters::ConnectionPool::Reaper#new
- ActiveRecord::ConnectionAdapters::ConnectionSpecification#new
- ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver#new
- ActiveRecord::ConnectionAdapters::RealTransaction#new
- ActiveRecord::ConnectionAdapters::SQLite3Adapter#new
- ActiveRecord::ConnectionAdapters::SavepointTransaction#new
- ActiveRecord::ConnectionAdapters::Transaction#new
- ActiveRecord::ConnectionAdapters::TransactionState#new
- ActiveRecord::DynamicMatchers::Method#new
- ActiveRecord::ExplainRegistry#new
- ActiveRecord::FixtureSet#new
- ActiveRecord::FixtureSet::File#new
- ActiveRecord::Migration::CheckPending#new
- ActiveRecord::NullMigration#new
- ActiveRecord::PendingMigrationError#new
- ActiveRecord::QueryMethods::WhereChain#new
- ActiveRecord::Relation::HashMerger#new
- ActiveRecord::Relation::Merger#new
- ActiveRecord::Scoping::ScopeRegistry#new
- ActiveRecord::StatementCache#new
- ActiveRecord::StatementInvalid#new
- ActiveRecord::Store::IndifferentCoder#new
- ActiveRecord::Tasks::MySQLDatabaseTasks#new
- ActiveRecord::Tasks::PostgreSQLDatabaseTasks#new
- ActiveRecord::Tasks::SQLiteDatabaseTasks#new
- ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry#new
- ActiveSupport::CachingKeyGenerator#new
- ActiveSupport::Deprecation#new
- ActiveSupport::KeyGenerator#new
- ActiveSupport::LegacyKeyGenerator#new
- ActiveSupport::Logger#new
- ActiveSupport::Notifications::Fanout::Subscribers::AllMessages#new
- ActiveSupport::Notifications::Fanout::Subscribers::Evented#new
- ActiveSupport::Notifications::InstrumentationRegistry#new
- ActiveSupport::Subscriber#new
- ActiveSupport::SubscriberQueueRegistry#new
- ActiveSupport::XMLConverter#new
- ActiveSupport::XMLConverter::DisallowedType#new
- CodeStatisticsCalculator#new
- Rails::API::Task#new
- ActionDispatch::Http::FilterParameters#new
- ActionDispatch::Http::URL#new
- ActionView::Helpers::Tags::CollectionHelpers#new
- ActiveModel::Model#new
- ActiveRecord::ConnectionAdapters::DatabaseStatements#new
- ActiveRecord::Core#new
- ActiveRecord::Inheritance::ClassMethods#new
- ActiveSupport::Notifications::Fanout::Subscribers#new
- Rails::Generators::Actions#new
- AbstractController::Helpers::MissingHelperError#new
- ActionController::Live::SSE#new
- ActionController::MimeResponds::Collector::VariantCollector#new
- ActionController::MissingRenderer#new
- ActionDispatch::Routing::Mapper::Scoping::Resources::Resource#new
- ActionDispatch::Routing::Mapper::Scoping::Resources::SingletonResource#new
- ActionView::I18nProxy#new
- ActionView::LogSubscriber#new
- ActionView::Template::HTML#new
- ActiveModel::Validations::ConfirmationValidator#new
- ActiveRecord::AssociationNotFoundError#new
- ActiveRecord::Associations::Builder::HasAndBelongsToMany#new
- ActiveRecord::Associations::Builder::HasAndBelongsToMany::JoinTableResolver::KnownClass#new
- ActiveRecord::Associations::JoinDependency::Aliases#new
- ActiveRecord::Associations::Preloader::AlreadyLoaded#new
- ActiveRecord::ConnectionAdapters::ConnectionSpecification::ConnectionUrlResolver#new
- ActiveRecord::ConnectionHandling::MergeAndResolveDefaultUrlConfig#new
- ActiveRecord::FixtureSet::ClassCache#new
- ActiveRecord::FixtureSet::ReflectionProxy#new
- ActiveRecord::MigrationError#new
- ActiveRecord::Reflection::ThroughReflection#new
- ActiveSupport::Callbacks::Conditionals::Value#new
- ActiveSupport::Concern::MultipleIncludedBlocks#new
- ActiveSupport::JSON::Encoding::JSONGemEncoder#new
- ActiveSupport::Multibyte::Unicode::Codepoint#new
- ActiveSupport::NumberHelper::NumberConverter#new
- ActiveSupport::Testing::SimpleStubs#new
- Rails::Application::DefaultMiddlewareStack#new
- Rails::Generators::ARGVScrubber#new
- Rails::Generators::AppBase::GemfileEntry#new
- Rails::Generators::PluginGenerator#new
- Rails::Railtie#new
- ActionDispatch::Routing::Mapper::Scoping::Resources#new
- ActionView::Layouts#new
- ActiveRecord::ConnectionAdapters::QueryCache#new
- ActionDispatch::Response::RackBody#new
- ActionDispatch::Routing::Mapper::Scoping::Scope#new
- ActionDispatch::Routing::Mapper::Scoping::Scope#new
- ActionDispatch::Routing::PolymorphicRoutes::HelperMethodBuilder#new
- ActionMailer::MessageDelivery#new
- ActionView::Helpers::Tags::Label::LabelBuilder#new
- ActionView::Helpers::Tags::Translator#new
- ActionView::PartialIteration#new
- ActiveJob::ConfiguredJob#new
- ActiveJob::DeserializationError#new
- ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper#new
- ActiveJob::QueueAdapters::QuAdapter::JobWrapper#new
- ActiveRecord::AttributeDecorators::TypeDecorator#new
- ActiveRecord::ConnectionAdapters::NullTransaction#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::Name#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Bit::Data#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Range#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::SpecializedString#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::TypeMapInitializer#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Vector#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Xml::Data#new
- ActiveRecord::ConnectionAdapters::TransactionManager#new
- ActiveRecord::HasOneAssociationPolymorphicThroughError#new
- ActiveRecord::RecordNotDestroyed#new
- ActiveRecord::RecordNotSaved#new
- ActiveRecord::StatementCache::BindMap#new
- ActiveRecord::StatementCache::PartialQuery#new
- ActiveRecord::StatementCache::Query#new
- ActiveRecord::Type::Serialized#new
- ActiveRecord::Type::TypeMap#new
- CodeTools::Profiler#new
- Rails::Application::Configuration::Custom#new
- ActionView::Helpers::Tags::Placeholderable#new
- ActiveJob::Core#new
- Rails::Generators::ModelHelpers#new
- ActionMailer::InlinePreviewInterceptor#new
- ActiveRecord::AssociationRelation#new
- ActiveRecord::ConnectionAdapters::AbstractAdapter::Version#new
- ActionView::Base#new
- ActionCable::Channel::Base#new
- ActionCable::Connection::Base#new
- ActionCable::Connection::ClientSocket#new
- ActionCable::Connection::MessageBuffer#new
- ActionCable::Connection::Stream#new
- ActionCable::Connection::StreamEventLoop#new
- ActionCable::Connection::Subscriptions#new
- ActionCable::Connection::TaggedLoggerProxy#new
- ActionCable::Connection::WebSocket#new
- ActionCable::RemoteConnections#new
- ActionCable::RemoteConnections::RemoteConnection#new
- ActionCable::Server::Base#new
- ActionCable::Server::Broadcasting::Broadcaster#new
- ActionCable::Server::Configuration#new
- ActionCable::Server::Worker#new
- ActionCable::SubscriptionAdapter::Async::AsyncSubscriberMap#new
- ActionCable::SubscriptionAdapter::Base#new
- ActionCable::SubscriptionAdapter::Inline#new
- ActionCable::SubscriptionAdapter::PostgreSQL#new
- ActionCable::SubscriptionAdapter::PostgreSQL::Listener#new
- ActionCable::SubscriptionAdapter::Redis#new
- ActionCable::SubscriptionAdapter::Redis::Listener#new
- ActionCable::SubscriptionAdapter::SubscriberMap#new
- ActionController::Renderer#new
- ActionController::Renderer#new
- ActionDispatch::AssertionResponse#new
- ActionDispatch::Cookies::AbstractCookieJar#new
- ActionDispatch::Executor#new
- ActionDispatch::Response::FileBody#new
- ActionDispatch::Response::Header#new
- ActionView::Digestor::Node#new
- ActiveJob::QueueAdapters::AsyncAdapter#new
- ActiveJob::QueueAdapters::AsyncAdapter::JobWrapper#new
- ActiveJob::QueueAdapters::AsyncAdapter::Scheduler#new
- ActiveJob::QueueAdapters::SneakersAdapter#new
- ActiveModel::Type::Binary::Data#new
- ActiveModel::Type::Helpers::AcceptsMultiparameterTime#new
- ActiveModel::Type::Integer#new
- ActiveModel::Type::Value#new
- ActiveModel::UnknownAttributeError#new
- ActiveModel::ValidationError#new
- ActiveModel::Validations::AcceptanceValidator::AttributeDefinition#new
- ActiveModel::Validations::AcceptanceValidator::LazilyDefineAttributes#new
- ActiveRecord::Associations::AssociationScope::ReflectionProxy#new
- ActiveRecord::Batches::BatchEnumerator#new
- ActiveRecord::ConcurrentMigrationError#new
- ActiveRecord::ConnectionAdapters::ConnectionPool::BiasableQueue::BiasedConditionVariable#new
- ActiveRecord::ConnectionAdapters::MySQL::TypeMetadata#new
- ActiveRecord::ConnectionAdapters::PostgreSQLTypeMetadata#new
- ActiveRecord::ConnectionAdapters::ReferenceDefinition#new
- ActiveRecord::Enum::EnumType#new
- ActiveRecord::EnvironmentMismatchError#new
- ActiveRecord::NoEnvironmentInSchemaError#new
- ActiveRecord::PredicateBuilder::ArrayHandler#new
- ActiveRecord::PredicateBuilder::AssociationQueryValue#new
- ActiveRecord::PredicateBuilder::BaseHandler#new
- ActiveRecord::PredicateBuilder::BasicObjectHandler#new
- ActiveRecord::PredicateBuilder::PolymorphicArrayValue#new
- ActiveRecord::PredicateBuilder::RangeHandler#new
- ActiveRecord::ProtectedEnvironmentError#new
- ActiveRecord::RecordNotFound#new
- ActiveRecord::Reflection::PolymorphicReflection#new
- ActiveRecord::Reflection::RuntimeReflection#new
- ActiveRecord::Relation::FromClause#new
- ActiveRecord::Relation::RecordFetchWarning::QueryRegistry#new
- ActiveRecord::Relation::WhereClause#new
- ActiveRecord::Relation::WhereClauseFactory#new
- ActiveRecord::SuppressorRegistry#new
- ActiveRecord::TableMetadata#new
- ActiveRecord::ThroughCantAssociateThroughHasOneOrManyReflection#new
- ActiveRecord::ThroughNestedAssociationsAreReadonly#new
- ActiveRecord::TypeCaster::Connection#new
- ActiveRecord::TypeCaster::Map#new
- ActiveSupport::Concurrency::ShareLock#new
- ActiveSupport::Dependencies::Interlock#new
- ActiveSupport::Duration::ISO8601Parser#new
- ActiveSupport::Duration::ISO8601Serializer#new
- ActiveSupport::EventedFileUpdateChecker#new
- ActiveSupport::Inflector::Inflections::Uncountables#new
- ActiveSupport::Reloader#new
- Mime::AllType#new
- Mime::Mimes#new
- Rails::Application::Finisher::MutexHook#new
- ActiveRecord::ConnectionAdapters#new
- ActionController::UnfilteredParameters#new
- ActionDispatch::DebugLocks#new
- ActionDispatch::Http::Parameters::ParseError#new
- ActionDispatch::RequestEncoder#new
- ActionDispatch::SystemTestCase#new
- ActionDispatch::SystemTesting::Driver#new
- ActionDispatch::TestResponse#new
- ActionMailer::Parameterized::Mailer#new
- ActionMailer::Parameterized::MessageDelivery#new
- ActionView::Helpers::TagHelper::TagBuilder#new
- ActionView::Template::Handlers::ERB::Erubi#new
- ActiveRecord::AmbiguousSourceReflectionForThroughAssociation#new
- ActiveRecord::HasManyThroughOrderError#new
- ActiveRecord::MismatchedForeignKey#new
- ActiveSupport::Callbacks::Callback::CallTemplate#new
- ActiveSupport::Callbacks::Callback::CallbackChain#new
- ActiveSupport::Callbacks::Callback::CallbackSequence#new
- ActiveSupport::Duration::Scalar#new
- ActiveSupport::NumberHelper::RoundingHelper#new
- Announcement::Version#new
- Rails::Command::ConsoleCommand#new
- Rails::Command::ServerCommand#new
- Rails::Secrets::MissingKeyError#new
- Rails::TestUnit::CompositeFilter#new
- Rails::TestUnit::Filter#new
- ActionDispatch::Integration::Runner#new
- ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration#new
- ActionDispatch::ContentSecurityPolicy#new
- ActionDispatch::ContentSecurityPolicy::Middleware#new
- ActionDispatch::Cookies::EncryptedKeyRotatingCookieJar#new
- ActionDispatch::Cookies::SignedKeyRotatingCookieJar#new
- ActionDispatch::SystemTesting::Browser#new
- ActionMailer::Preview#new
- ActiveModel::Attribute#new
- ActiveModel::Attribute::Null#new
- ActiveModel::Attribute::Uninitialized#new
- ActiveModel::Attribute::UserProvidedDefault#new
- ActiveModel::AttributeMutationTracker#new
- ActiveModel::AttributeSet#new
- ActiveModel::AttributeSet::Builder#new
- ActiveModel::AttributeSet::YAMLEncoder#new
- ActiveModel::LazyAttributeHash#new
- ActiveRecord::Associations::JoinDependency::JoinBase#new
- ActiveRecord::AttributeMethods::Serialization::ColumnNotSerializableError#new
- ActiveRecord::ConnectionAdapters::DatabaseStatements::PartialQueryCollector#new
- ActiveRecord::ConnectionAdapters::IndexDefinition#new
- ActiveRecord::ConnectionAdapters::PostgreSQL::AlterTable#new
- ActiveRecord::MigrationContext#new
- ActiveStorage::Analyzer#new
- ActiveStorage::Attached#new
- ActiveStorage::Filename#new
- ActiveStorage::Filename::Parameters#new
- ActiveStorage::Preview#new
- ActiveStorage::Previewer#new
- ActiveStorage::Service::AzureStorageService#new
- ActiveStorage::Service::Configurator#new
- ActiveStorage::Service::DiskService#new
- ActiveStorage::Service::GCSService#new
- ActiveStorage::Service::MirrorService#new
- ActiveStorage::Service::S3Service#new
- ActiveStorage::Variant#new
- ActiveStorage::Variation#new
- ActiveSupport::Cache::RedisCacheStore#new
- ActiveSupport::CurrentAttributes#new
- ActiveSupport::EncryptedConfiguration#new
- ActiveSupport::EncryptedFile#new
- ActiveSupport::EncryptedFile::MissingContentError#new
- ActiveSupport::EncryptedFile::MissingKeyError#new
- ActiveSupport::Messages::Metadata#new
- ActiveSupport::Messages::RotationConfiguration#new
- ActiveModel::Attributes#new
- ActiveSupport::Messages::Rotator#new
new(attributes = nil, options = {})
public
New objects can be instantiated as either empty (pass no construction parameter) or pre-set with attributes but not yet saved (pass a hash with key names matching the associated table column names). In both instances, valid attribute keys are determined by the column names of the associated table – hence you can’t have attributes that aren’t part of the table columns.
initialize respects mass-assignment security and accepts either :as or :without_protection options in the options parameter.
Examples
# Instantiates a single new object User.new(:first_name => 'Jamie') # Instantiates a single new object using the :admin mass-assignment security role User.new({ :first_name => 'Jamie', :is_admin => true }, :as => :admin) # Instantiates a single new object bypassing mass-assignment security User.new({ :first_name => 'Jamie', :is_admin => true }, :without_protection => true)
# File activerecord/lib/active_record/base.rb, line 481 def initialize(attributes = nil, options = {}) defaults = Hash[self.class.column_defaults.map { |k, v| [k, v.duplicable? ? v.dup : v] }] @attributes = self.class.initialize_attributes(defaults) @association_cache = {} @aggregation_cache = {} @attributes_cache = {} @new_record = true @readonly = false @destroyed = false @marked_for_destruction = false @previously_changed = {} @changed_attributes = {} ensure_proper_type populate_with_current_scope_attributes assign_attributes(attributes, options) if attributes yield self if block_given? run_callbacks :initialize end




Setting primary key from hash
If you try to specify the value for your primary key (usually “id”) through the attributes hash, it will be stripped out:
Post.new(:id => 5, :title => 'Foo') #=> #<Post @id=nil @title="Foo">
You can solve this by setting it directly, perhaps by using a block:
Post.new(:title => "Foo") { |p| p.id = 5 } #=> #<Post @id=5 @title="Foo">
This behavior is something you’d probably only have a problem with when you have custom primary keys. Perhaps you have a User model with a primary key of “name”…
class User < ActiveRecord::Base set_primary_key :name end User.new(params[:user]) # This will never work
You can solve this on a case-to-case basis by calling attributes= directly with the “ignore protected” option:
User.new { |user| user.send(:attributes=, params[:user], false) } # BAD BAD BAD!
You should not do the above example, though. If you do, all protected attributes are ignored, which is very, very bad when you only care about the primary key.
I’d recommend one of the following instead:
# Option 1 – Always allow primary key. Avoid with models created by users class User private def attributes_protected_by_default super - [self.class.primary_key.to_s] end end # Option 2 – Add a new method for this case class User def self.new_with_name(attributes = nil) new(attributes) { |u| u.name = attributes[:name] } end end
As always when something is hard to do in Rails: Think about your design? Is it recommended? Is it sound? Do you really need to have a custom primary key?


4.0.2 support
Where did this go in 4.0.2?