In Rails, ActiveRecord objects, attributes are accessible via method as well as through Hash. Example:
user = User.first # Assuming User to be inheriting from ActiveRecord::Base
user.name # Accessing attribute 'name' via method
user[:name] # Attribute 'name' is accessible via hash as well
How to make instance variables accessible through hash for classes not inheriting from ActiveRecord::Base?