> For the complete documentation index, see [llms.txt](https://kelby.gitbook.io/rails-beginner-s-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kelby.gitbook.io/rails-beginner-s-guide/activerecord_association_achitecture/associations_under_builder/builder_association.md).

# Association

类方法：

```ruby
class << self
  attr_accessor :extensions
  attr_accessor :valid_options
end

build

create_builder

define_callbacks
define_accessors
define_readers
define_writers
define_validations

valid_dependent_options
```

实例方法：

```
attr_reader :name, :scope, :options

build

macro

valid_options

validate_options

define_extensions
```

其它类方法：

```
check_dependent_options

add_destroy_callbacks
```
