Class: Ardm::ActiveRecord::Record

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Base
Defined in:
lib/ardm/active_record/record.rb

Constant Summary collapse

JSON =
Json

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Validations

extract_options

Methods included from Repository

#repository

Methods included from Query

order

Methods included from Property

#attribute_get, #attribute_set, extended, #fields, #initialize_ardm_property_defaults, #properties, #reset_key

Methods included from Dirty

#dirty?, #dirty_attributes, #method_missing

Methods included from Associations

#assign_attributes, convert_options

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ardm::ActiveRecord::Dirty

Class Method Details

.execute_sql(sql) ⇒ Object



17
18
19
# File 'lib/ardm/active_record/record.rb', line 17

def self.execute_sql(sql)
  connection.execute(sql)
end

.finalizeObject



14
15
# File 'lib/ardm/active_record/record.rb', line 14

def self.finalize
end

.property(property_name, property_type, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/ardm/active_record/record.rb', line 21

def self.property(property_name, property_type, options={})
  property = super
  begin
  attr_accessible property.name
  attr_accessible property.field
  rescue => e
    puts "WARNING: Error silenced. FIXME before release.\n#{e}"
  end
  property
end

.timestamps(*a) ⇒ Object

no-op in active record



33
34
# File 'lib/ardm/active_record/record.rb', line 33

def self.timestamps(*a)
end

Instance Method Details

#keyObject



36
37
38
# File 'lib/ardm/active_record/record.rb', line 36

def key
  id
end

#new?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/ardm/active_record/record.rb', line 40

def new?
  new_record?
end

#save_selfObject



44
45
46
# File 'lib/ardm/active_record/record.rb', line 44

def save_self(*)
  save
end

#update(*a) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/ardm/active_record/record.rb', line 48

def update(*a)
  if a.size == 1
    update_attributes(*a)
  else
    super
  end
end

#update!(*a) ⇒ Object



56
57
58
# File 'lib/ardm/active_record/record.rb', line 56

def update!(*a)
  update_attributes!(*a)
end