Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/m_active_record_base.rb,
lib/m_active_record_base.rb

Instance Method Summary collapse

Instance Method Details

#is_deleted?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
# File 'lib/m_active_record_base.rb', line 8

def is_deleted?
  if self.respond_to?(:deleted_at)
    return !self.deleted_at.nil?
  end
  false
end

#old_updateObject



15
# File 'lib/m_active_record_base.rb', line 15

alias_method :old_update, :update

#to_iObject



3
4
5
6
# File 'lib/m_active_record_base.rb', line 3

def to_i
  # return the id of the object when calling the to_i method.
  self.id
end

#update(check_validation = true) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/m_active_record_base.rb', line 17

def update(check_validation = true)
  if check_validation
    return old_update if self.valid?
  else
    return old_update
  end
  return false
end