Reserved names with ActiveRecord models Reserved names with ActiveRecord models ruby-on-rails ruby-on-rails

Reserved names with ActiveRecord models


Reserved Word List

ADDITIONAL_LOAD_PATHSARGFARGVActionControllerActionViewActiveRecordArgumentErrorArrayBasicSocketBenchmarkBignumBindingCGICGIMethodsCROSS_COMPILINGClassClassInheritableAttributesComparableConditionVariableConfigContinuationDRbDRbIdConvDRbObjectDRbUndumpedDataDateDateTimeDelegaterDelegatorDigestDirENVEOFErrorERBEnumerableErrnoExceptionFALSEFalseClassFcntlFileFileListFileTaskFileTestFileUtilsFixnumFloatFloatDomainErrorGCGemGetoptLongHashIOIOErrorIPSocketIPsocketIndexErrorInflectorIntegerInterruptKernelLN_SUPPORTEDLoadErrorLocalJumpErrorLoggerMarshalMatchDataMatchingDataMathMethodModuleMutexMysqlMysqlErrorMysqlFieldMysqlResNILNameErrorNilClassNoMemoryErrorNoMethodErrorNoWriteNotImplementedErrorNumericOPT_TABLEObjectObjectSpaceObservableObserverPGErrorPGconnPGlargePGresultPLATFORMPStoreParseDatePrecisionProcProcessQueueRAKEVERSIONRELEASE_DATERUBYRUBY_PLATFORMRUBY_RELEASE_DATERUBY_VERSIONRackRakeRakeAppRakeFileUtilsRangeRangeErrorRationalRegexpRegexpErrorRequestRuntimeErrorSTDERRSTDINSTDOUTScanErrorScriptErrorSecurityErrorSignalSignalExceptionSimpleDelegaterSimpleDelegatorSingletonSizedQueueSocketSocketErrorStandardErrorStringStringScannerStructSymbolSyntaxErrorSystemCallErrorSystemExitSystemStackErrorTCPServerTCPSocketTCPserverTCPsocketTOPLEVEL_BINDINGTRUETaskTextThreadThreadErrorThreadGroupTimeTransactionTrueClassTypeErrorUDPSocketUDPsocketUNIXServerUNIXSocketUNIXserverUNIXsocketUnboundMethodUrlVERSIONVerboseYAMLZeroDivisionError@base_pathacceptAccesAxiactionattributesapplication2callbackcategoryconnectiondatabasedispatcherdisplay1driveerrorsformathostkeylayoutloadlinknewnotifyopenpublicquoterenderrequestrecordsresponsessavescopesendsessionsystemtemplatetesttimeoutto_stypeURIvisitsObserver

Database Field Names

created_atcreated_onupdated_atupdated_ondeleted_at(paranoiagem)lock_versiontypeid#{table_name}_countpositionparent_idlftrgtquote_value

Ruby Reserved Words

aliasandBEGINbeginbreakcaseclassdefdefined?doelseelsifENDendensurefalseforifmodulenextnilnotorredorescueretryreturnselfsuperthentrueundefunlessuntilwhenwhileyield_ FILE __ LINE _


Column name type is also reserved and does not show in the list of MyModel.methods!

The single-table inheritance mechanism failed to locate the subclass: 'f'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Project.inheritance_column to use another column for that information.

Does anyone have experience with names like category, class, transaction, group, etc.? All pop into mind when I'm categorising data within my db....


Here's the list as of Rails 5.1.5:

!!=!~<=>======~[][]=__binding____callbacks__callbacks?__id____send___before_commit_callbacks_before_commit_without_transaction_enrollment_callbacks_commit_callbacks_commit_without_transaction_enrollment_callbacks_create_callbacks_destroy_destroy_callbacks_find_callbacks_initialize_callbacks_read_attribute_reflections_reflections?_rollback_callbacks_rollback_without_transaction_enrollment_callbacks_run_before_commit_callbacks_run_before_commit_without_transaction_enrollment_callbacks_run_commit_callbacks_run_commit_without_transaction_enrollment_callbacks_run_create_callbacks_run_destroy_callbacks_run_find_callbacks_run_initialize_callbacks_run_rollback_callbacks_run_rollback_without_transaction_enrollment_callbacks_run_save_callbacks_run_touch_callbacks_run_update_callbacks_run_validate_callbacks_run_validation_callbacks_save_callbacks_touch_callbacks_update_callbacks_validate_callbacks_validation_callbacks_validators_validators?`accessed_fieldsacts_like?add_to_transactionaggregate_reflectionsaggregate_reflections?as_jsonassign_attributesassociationassociation_cached?attribute_aliasesattribute_aliases?attribute_before_last_saveattribute_changeattribute_change_to_be_savedattribute_changed?attribute_changed_in_place?attribute_for_inspectattribute_in_databaseattribute_method_matchersattribute_method_matchers?attribute_missingattribute_namesattribute_present?attribute_previously_changed?attribute_wasattributesattributes=attributes_before_type_castattributes_changed_by_setterattributes_in_databasebecomesbecomes!before_committed!blank?byebugcache_keycache_timestamp_formatcache_timestamp_format?changedchanged?changed_attribute_names_to_savechanged_attributeschanged_for_autosave?changeschanges_appliedchanges_internally_appliedchanges_to_saveclassclass_evalclear_attribute_changesclear_changes_informationclonecolumn_for_attributecommitted!connection_handlerdebuggerdecrementdecrement!deep_dupdefault_connection_handlerdefault_connection_handler?default_scope_overridedefault_scopesdefault_timezonedefine_singleton_methoddefined_enumsdefined_enums?deletedestroydestroy!destroyed?destroyed_by_associationdestroyed_by_association=displaydump_schema_after_migrationdump_schemasdupduplicable?encode_withenum_foreql?equal?error_on_ignored_ordererror_on_ignored_order_or_limiterrorsextendfreezefrom_jsonfrozen?gemhas_attribute?has_changes_to_save?hashhtml_safe?idid=id?id_before_type_castid_in_databaseid_wasin?include_root_in_jsoninclude_root_in_json?incrementincrement!index_nested_attribute_errorsinit_withinitialize_internals_callbackinspectinstance_evalinstance_execinstance_of?instance_valuesinstance_variable_defined?instance_variable_getinstance_variable_namesinstance_variable_setinstance_variablesinvalid?is_a?itselfkind_of?load_dependencylock!lock_optimisticallylock_optimistically?locking_enabled?loggermark_for_destructionmarked_for_destruction?methodmethod_missingmethodsmodel_namenested_attributes_optionsnested_attributes_options?new_record?nil?no_touching?object_idpartial_writespartial_writes?persisted?pluralize_table_namespluralize_table_names?populate_with_current_scope_attributespresencepresence_inpresent?pretty_inspectpretty_printpretty_print_cyclepretty_print_inspectpretty_print_instance_variablesprevious_changesprimary_key_prefix_typeprivate_methodsprotected_methodsprypublic_methodpublic_methodspublic_sendquery_attributequoted_idraw_write_attributeread_attributeread_attribute_before_type_castread_attribute_for_serializationread_attribute_for_validationreadonly!readonly?record_timestampsrecord_timestamps=record_timestamps?reloadremote_byebugremove_instance_variablerequire_dependencyrequire_or_loadrespond_to?respond_to_without_attributes?restore_attributesrollback_active_record_state!rolledback!run_callbackssavesave!saved_change_to_attributesaved_change_to_attribute?saved_changessaved_changes?schema_formatsendserializable_hashsingleton_classsingleton_methodsingleton_methodsskip_time_zone_conversion_for_attributesskip_time_zone_conversion_for_attributes?slicestore_full_sti_classstore_full_sti_class?suppress_warningstable_name_prefixtable_name_prefix?table_name_suffixtable_name_suffix?tainttainted?taptime_zone_aware_attributestime_zone_aware_typestime_zone_aware_types?timestamped_migrationsto_enumto_gidto_gid_paramto_global_idto_jsonto_keyto_modelto_paramto_partial_pathto_queryto_sto_sgidto_sgid_paramto_signed_global_idto_yamltoggletoggle!touchtouch_latertransactiontrusttrytry!type_for_attributeunloadableuntaintuntrustuntrusted?updateupdate!update_attributeupdate_attributesupdate_attributes!update_columnupdate_columnsvalid?validatevalidate!validates_absence_ofvalidates_acceptance_ofvalidates_confirmation_ofvalidates_exclusion_ofvalidates_format_ofvalidates_inclusion_ofvalidates_length_ofvalidates_numericality_ofvalidates_presence_ofvalidates_size_ofvalidates_withvalidation_contextwarn_on_records_fetched_greater_thanwill_save_change_to_attribute?with_lockwith_optionswith_transaction_returning_statuswrite_attributeyield_self

You can get it with

ActiveRecord::Base.instance_methods.sort