Class: ActiveRecord::Relation::QueryAttribute
- Inherits:
-
ActiveModel::Attribute
- Object
- ActiveModel::Attribute
- ActiveRecord::Relation::QueryAttribute
- Defined in:
- lib/active_record/relation/query_attribute.rb
Overview
:nodoc:
Instance Method Summary collapse
- #boundable? ⇒ Boolean
- #infinity? ⇒ Boolean
- #nil? ⇒ Boolean
- #type_cast(value) ⇒ Object
- #value_for_database ⇒ Object
- #with_cast_value(value) ⇒ Object
Instance Method Details
#boundable? ⇒ Boolean
25 26 27 28 29 30 31 |
# File 'lib/active_record/relation/query_attribute.rb', line 25 def boundable? return @_boundable if defined?(@_boundable) nil? @_boundable = true rescue ::RangeError @_boundable = false end |
#infinity? ⇒ Boolean
33 34 35 |
# File 'lib/active_record/relation/query_attribute.rb', line 33 def infinity? _infinity?(value_before_type_cast) || boundable? && _infinity?(value_for_database) end |
#nil? ⇒ Boolean
20 21 22 23 |
# File 'lib/active_record/relation/query_attribute.rb', line 20 def nil? !value_before_type_cast.is_a?(StatementCache::Substitute) && (value_before_type_cast.nil? || value_for_database.nil?) end |
#type_cast(value) ⇒ Object
8 9 10 |
# File 'lib/active_record/relation/query_attribute.rb', line 8 def type_cast(value) value end |
#value_for_database ⇒ Object
12 13 14 |
# File 'lib/active_record/relation/query_attribute.rb', line 12 def value_for_database @value_for_database ||= super end |
#with_cast_value(value) ⇒ Object
16 17 18 |
# File 'lib/active_record/relation/query_attribute.rb', line 16 def with_cast_value(value) QueryAttribute.new(name, value, type) end |