LoginSignup
8
9

More than 5 years have passed since last update.

ActiveModel 内の include・extend 関係

Posted at

環境
- Rails 4.1.1

ActiveModelについての覚書です。ActiveModelパッケージ内での、クラス・モジュール間のinclude・extendを図にしました。

Model, Naming, Conversion, Translation, Validations
activemodel_class_diagram_1.png
ActiveModel::Model
ActiveModel::Naming
ActiveModel::Conversion
ActiveModel::Translation
ActiveModel::Validations
ActiveModel::Callbacks

AttributeMethods, Dirty
activemodel_class_diagram_2.png
ActiveModel::AttributeMethods
ActiveModel::Dirty

Serialization, Xml, JSON
activemodel_class_diagram_3.png
ActiveModel::Serialization
ActiveModel::Serializers::Xml
ActiveModel::Serializers::JSON


active_model.rb
module ActiveModel
  extend ActiveSupport::Autoload

  autoload :AttributeMethods
  autoload :BlockValidator, 'active_model/validator'
  autoload :Callbacks
  autoload :Conversion
  autoload :Dirty
  autoload :EachValidator, 'active_model/validator'
  autoload :ForbiddenAttributesProtection
  autoload :Lint
  autoload :Model
  autoload :Name, 'active_model/naming'
  autoload :Naming
  autoload :SecurePassword
  autoload :Serialization
  autoload :TestCase
  autoload :Translation
  autoload :Validations
  autoload :Validator
...
8
9
0

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
8
9