Module: DatastaxRails::AttributeMethods

Extended by:
ActiveSupport::Autoload, ActiveSupport::Concern
Includes:
ActiveModel::AttributeMethods
Included in:
Base
Defined in:
lib/datastax_rails.rb,
lib/datastax_rails/attribute_methods.rb,
lib/datastax_rails/attribute_methods/read.rb,
lib/datastax_rails/attribute_methods/dirty.rb,
lib/datastax_rails/attribute_methods/write.rb,
lib/datastax_rails/attribute_methods/definition.rb,
lib/datastax_rails/attribute_methods/primary_key.rb,
lib/datastax_rails/attribute_methods/typecasting.rb

Overview

Module to hold attribute method related functionality

Defined Under Namespace

Modules: ClassMethods, Dirty, PrimaryKey, Read, Typecasting, Write Classes: Definition

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_id, *args, &block) ⇒ Object



127
128
129
130
131
132
133
134
# File 'lib/datastax_rails/attribute_methods.rb', line 127

def method_missing(method_id, *args, &block)
  if !self.class.attribute_methods_generated?
    self.class.define_attribute_methods
    send(method_id, *args, &block)
  else
    super
  end
end

Instance Method Details

#attribute_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


123
124
125
# File 'lib/datastax_rails/attribute_methods.rb', line 123

def attribute_exists?(name)
  @attributes.key?(name.to_s)
end

#column_for_attribute(name) ⇒ Object



141
142
143
# File 'lib/datastax_rails/attribute_methods.rb', line 141

def column_for_attribute(name)
  self.class.column_for_attribute(name)
end

#respond_to?(*args) ⇒ Boolean

Returns:

  • (Boolean)


136
137
138
139
# File 'lib/datastax_rails/attribute_methods.rb', line 136

def respond_to?(*args)
  self.class.define_attribute_methods unless self.class.attribute_methods_generated?
  super
end