39
36

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails 4.0.0.beta1で使わない方がよさそうなDBのカラム名

Posted at

【Rails3】カラム名に使ってはいけない予約語を調べる - ふわふわRuby on Rails

を参考にして、空のモデルを作ってメソッド名を書きだす

hoge.rb
class Hoge < ActiveRecord::Base
end
% rails c
Loading development environment (Rails 4.0.0.beta1)

> hoge = Hoge.new
=> #<Hoge id: nil, created_at: nil, updated_at: nil>

> open('methods.txt', 'w'){ |file|
>   file.print(hoge.methods.join("\n"))
> }
=> nil
methods.txt
!
!=
!~
<=>
==
===
=~
[]
[]=
__id__
__send__
_attr_readonly
_commit_callbacks
_commit_callbacks=
_commit_callbacks?
_create_callbacks
_create_callbacks=
_create_callbacks?
_destroy
_destroy_callbacks
_destroy_callbacks=
_destroy_callbacks?
_find_callbacks
_find_callbacks=
_find_callbacks?
_initialize_callbacks
_initialize_callbacks=
_initialize_callbacks?
_rollback_callbacks
_rollback_callbacks=
_rollback_callbacks?
_save_callbacks
_save_callbacks=
_save_callbacks?
_touch_callbacks
_touch_callbacks=
_touch_callbacks?
_update_callbacks
_update_callbacks=
_update_callbacks?
_validate_callbacks
_validate_callbacks=
_validate_callbacks?
_validation_callbacks
_validation_callbacks=
_validation_callbacks?
_validators
_validators=
_validators?
`
acts_like?
add_to_transaction
arel_attributes_with_values_for_create
arel_attributes_with_values_for_update
as_json
assign_attributes
association
association_cache
attribute_aliases
attribute_aliases?
attribute_for_inspect
attribute_method?
attribute_method_matchers
attribute_method_matchers?
attribute_missing
attribute_names
attribute_present?
attribute_types_cached_by_default
attribute_types_cached_by_default?
attributes
attributes=
attributes_before_type_cast
becomes
becomes!
blank?
breakpoint
cache_key
cache_timestamp_format
cache_timestamp_format?
capture
changed
changed?
changed_attributes
changed_for_autosave?
changes
class
class_eval
clear_aggregation_cache
clear_association_cache
clear_transaction_record_state
clone
clone_attribute_value
clone_attributes
column_for_attribute
committed!
configurations
connection
connection_handler
connection_handler?
debugger
decrement
decrement!
deep_dup
default_scopes
default_scopes?
default_timezone
define_singleton_method
delete
destroy
destroy!
destroyed?
display
dup
duplicable?
enable_warnings
encode_with
enum_for
eql?
equal?
errors
extend
freeze
from_json
from_xml
frozen?
gem
has_attribute?
has_transactional_callbacks?
hash
html_safe?
id
id=
id?
id_before_type_cast
in?
include_root_in_json
include_root_in_json=
include_root_in_json?
increment
increment!
init_with
inspect
instance_eval
instance_exec
instance_of?
instance_values
instance_variable_defined?
instance_variable_get
instance_variable_names
instance_variable_set
instance_variables
invalid?
is_a?
kind_of?
load
load_dependency
lock!
lock_optimistically
lock_optimistically?
locking_enabled?
logger
mark_for_destruction
marked_for_destruction?
method
method_missing
methods
nested_attributes_options
nested_attributes_options?
new_record?
nil?
object_id
partial_writes
partial_writes?
perform_validations
persisted?
pluralize_table_names
pluralize_table_names?
populate_with_current_scope_attributes
presence
present?
pretty_inspect
pretty_print
pretty_print_cycle
pretty_print_inspect
pretty_print_instance_variables
previous_changes
primary_key_prefix_type
private_methods
protected_methods
psych_to_yaml
public_method
public_methods
public_send
query_attribute
quietly
quoted_id
raw_write_attribute
read_attribute
read_attribute_before_type_cast
read_attribute_for_serialization
read_attribute_for_validation
read_store_attribute
readonly!
readonly?
record_timestamps
record_timestamps=
record_timestamps?
reflections
reflections=
reflections?
reload
remember_transaction_record_state
remove_instance_variable
require
require_dependency
require_or_load
respond_to?
respond_to_without_attributes?
restore_transaction_record_state
rollback_active_record_state!
rolledback!
run_callbacks
run_validations!
sanitize_for_mass_assignment
save
save!
schema_format
send
serializable_hash
serialized_attributes
set_transaction_state
silence
silence_stderr
silence_stream
silence_warnings
singleton_class
singleton_methods
skip_time_zone_conversion_for_attributes
skip_time_zone_conversion_for_attributes?
slice
store_full_sti_class
store_full_sti_class?
suppress
suppress_warnings
table_name_prefix
table_name_prefix?
table_name_suffix
table_name_suffix?
taint
tainted?
tap
time_zone_aware_attributes
timestamped_migrations
to_enum
to_json
to_key
to_model
to_param
to_partial_path
to_query
to_s
to_xml
to_yaml
to_yaml_properties
toggle
toggle!
touch
transaction
transaction_include_any_action?
transaction_record_state
trust
try
try!
unloadable
untaint
untrust
untrusted?
update
update!
update_attribute
update_attributes
update_attributes!
update_column
update_columns
valid?
validates_absence_of
validates_acceptance_of
validates_confirmation_of
validates_exclusion_of
validates_format_of
validates_inclusion_of
validates_length_of
validates_numericality_of
validates_presence_of
validates_size_of
validates_with
validation_context
validation_context=
with_lock
with_options
with_transaction_returning_status
with_warnings
write_store_attribute

雑感

  • rails4ではtypeは使っても大丈夫そう。
  • quoted_id知らなかった。文字通り"1"とか"NULL"とか"で括られたidが返ってくる
39
36
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
39
36

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?