- It will be a personal memorandum *
table of contents
Why you can get the value by. (Dot) + column name when accessing the database instance
Because it is an instance (object) created by a class that inherits Active Record, it is possible to get the value using the .method.
Since it is not the usual Ruby notation, I want to get the value for the hash object, so if I write it with dots, an error will occur.
How to get the hash value in Ruby
How to get a value in an object created from a class that inherits AR
#Assuming that the Hash class has already been defined, Hash.Create an instance with new hash = Hash.new(name: 'hoge', email: '[email protected]') hash[:name] => "hoge" hash.name => "hoge"