Class: ActiveRecord::Key
| Relationships & Source Files | |
| Namespace Children | |
|
Classes:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
|
|
| Inherits: | Object |
| Defined in: | activerecord/lib/active_record/key.rb |
Class Method Summary
Instance Attribute Summary
- #columns readonly
- #composite? ⇒ Boolean readonly
- #name readonly
- #present? ⇒ Boolean readonly
::Enumerable - Included
| #many? | Returns |
Instance Method Summary
- #==(other) (also: #eql?)
- #arel_columns(table)
- #cast(values, model)
- #each(&block)
-
#eql?(other)
Alias for #==.
- #expects_multiple_ids?(value) ⇒ Boolean
- #hash
- #inferred_id
- #length (also: #size)
-
#size
Alias for #length.
- #to_a
- #to_s
- #value_of(record)
- #where_clauses(values)
- #where_hash(values)
::Enumerable - Included
| #compact_blank | Returns a new |
| #exclude? | The negative of the |
| #excluding | Returns a copy of the enumerable excluding the specified elements. |
| #in_order_of | Returns a new |
| #including | Returns a new array that includes the passed elements. |
| #index_by | Convert an enumerable to a hash, using the block result as the key and the element as the value. |
| #index_with | Convert an enumerable to a hash, using the element as the key and the block result as the value. |
| #maximum | Calculates the maximum from the extracted elements. |
| #minimum | Calculates the minimum from the extracted elements. |
| #pick | Extract the given key from the first element in the enumerable. |
| #pluck | Extract the given key from each element in the enumerable. |
| #sole | Returns the sole item in the enumerable. |
| #without | Alias for Enumerable#excluding. |
| #as_json | |
::ActiveSupport::EnumerableCoreExt::Constants - Included
Class Method Details
.for(name)
[ GitHub ]Instance Attribute Details
#columns (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/key.rb', line 18
attr_reader :name, :columns
#composite? ⇒ Boolean (readonly)
# File 'activerecord/lib/active_record/key.rb', line 50
def composite? raise NotImplementedError end
#name (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/key.rb', line 18
attr_reader :name, :columns
#present? ⇒ Boolean (readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/key.rb', line 20
def present? !@columns.empty? end
Instance Method Details
#==(other) Also known as: #eql?
[ GitHub ]#arel_columns(table)
# File 'activerecord/lib/active_record/key.rb', line 58
def arel_columns(table) raise NotImplementedError end
#cast(values, model)
# File 'activerecord/lib/active_record/key.rb', line 62
def cast(values, model) raise NotImplementedError end
#each(&block)
[ GitHub ]# File 'activerecord/lib/active_record/key.rb', line 24
def each(&block) @columns.each(&block) end
#eql?(other)
Alias for #==.
# File 'activerecord/lib/active_record/key.rb', line 44
alias_method :eql?, :==
#expects_multiple_ids?(value) ⇒ Boolean
# File 'activerecord/lib/active_record/key.rb', line 70
def expects_multiple_ids?(value) raise NotImplementedError end
#hash
[ GitHub ]# File 'activerecord/lib/active_record/key.rb', line 46
def hash name.hash end
#inferred_id
# File 'activerecord/lib/active_record/key.rb', line 74
def inferred_id raise NotImplementedError end
#length Also known as: #size
[ GitHub ]# File 'activerecord/lib/active_record/key.rb', line 28
def length @columns.length end
#size
Alias for #length.
# File 'activerecord/lib/active_record/key.rb', line 31
alias_method :size, :length
#to_a
[ GitHub ]# File 'activerecord/lib/active_record/key.rb', line 33
def to_a @columns end
#to_s
[ GitHub ]# File 'activerecord/lib/active_record/key.rb', line 37
def to_s @name.to_s end
#value_of(record)
# File 'activerecord/lib/active_record/key.rb', line 66
def value_of(record) raise NotImplementedError end
#where_clauses(values)
# File 'activerecord/lib/active_record/key.rb', line 78
def where_clauses(values) raise NotImplementedError end
#where_hash(values)
# File 'activerecord/lib/active_record/key.rb', line 54
def where_hash(values) raise NotImplementedError end