Module: CouchbaseOrm::ActiveRecordCompat::ClassMethods
- Defined in:
- lib/couchbase-orm/base.rb
Instance Method Summary collapse
- #_reflect_on_association(_attribute) ⇒ Object
- #abstract_class? ⇒ Boolean
- #attribute_names ⇒ Object
-
#attributes_builder ⇒ Object
:nodoc:.
- #base_class? ⇒ Boolean
-
#column_names ⇒ Object
can’t be an alias for now.
-
#composite_primary_key? ⇒ Boolean
ActiveRecord 7.1 compatibility.
- #connected? ⇒ Boolean
-
#connection ⇒ Object
Stub connection for ActiveRecord::Timestamp compatibility.
- #generate_alias_attributes(*args) ⇒ Object
- #primary_key ⇒ Object
- #table_exists? ⇒ Boolean
- #type_for_attribute(attribute) ⇒ Object
Instance Method Details
#_reflect_on_association(_attribute) ⇒ Object
77 78 79 |
# File 'lib/couchbase-orm/base.rb', line 77 def _reflect_on_association(_attribute) false end |
#abstract_class? ⇒ Boolean
55 56 57 |
# File 'lib/couchbase-orm/base.rb', line 55 def abstract_class? false end |
#attribute_names ⇒ Object
94 95 96 |
# File 'lib/couchbase-orm/base.rb', line 94 def attribute_names attribute_types.keys end |
#attributes_builder ⇒ Object
:nodoc:
85 86 87 88 89 90 91 |
# File 'lib/couchbase-orm/base.rb', line 85 def attributes_builder # :nodoc: unless defined?(@attributes_builder) && @attributes_builder defaults = _default_attributes @attributes_builder = ActiveModel::AttributeSet::Builder.new(attribute_types, defaults) end @attributes_builder end |
#base_class? ⇒ Boolean
46 47 48 |
# File 'lib/couchbase-orm/base.rb', line 46 def base_class? true end |
#column_names ⇒ Object
can’t be an alias for now
51 52 53 |
# File 'lib/couchbase-orm/base.rb', line 51 def column_names attribute_names end |
#composite_primary_key? ⇒ Boolean
ActiveRecord 7.1 compatibility
73 74 75 |
# File 'lib/couchbase-orm/base.rb', line 73 def composite_primary_key? false end |
#connection ⇒ Object
Stub connection for ActiveRecord::Timestamp compatibility
68 69 70 |
# File 'lib/couchbase-orm/base.rb', line 68 def connection @connection ||= Struct.new(:default_timezone).new(:utc) end |
#generate_alias_attributes(*args) ⇒ Object
103 104 105 106 107 108 109 |
# File 'lib/couchbase-orm/base.rb', line 103 def generate_alias_attributes(*args) # In Rails 7.1+, this method was renamed and signature changed # ActiveRecord 7.1 still calls it with no args, so we handle that case return if args.empty? generate_alias_attribute_methods(*args) end |
#primary_key ⇒ Object
42 43 44 |
# File 'lib/couchbase-orm/base.rb', line 42 def primary_key 'id' end |
#table_exists? ⇒ Boolean
63 64 65 |
# File 'lib/couchbase-orm/base.rb', line 63 def table_exists? true end |
#type_for_attribute(attribute) ⇒ Object
81 82 83 |
# File 'lib/couchbase-orm/base.rb', line 81 def type_for_attribute(attribute) attribute_types[attribute] end |