Class: Customer

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/generators/ifd_tools/install/templates/models/customer.rb

Constant Summary collapse

Statuses =
%w(active banned pending)

Instance Method Summary collapse

Instance Method Details

#activate!Object



42
43
44
# File 'lib/generators/ifd_tools/install/templates/models/customer.rb', line 42

def activate!
  update_attribute :status, "active"
end

#active?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/generators/ifd_tools/install/templates/models/customer.rb', line 50

def active?
  status == "active"
end

#deactivate!Object



46
47
48
# File 'lib/generators/ifd_tools/install/templates/models/customer.rb', line 46

def deactivate!
  update_attribute :status, "banned"
end

#display_nameObject



34
35
36
# File 'lib/generators/ifd_tools/install/templates/models/customer.rb', line 34

def display_name
  full_name
end

#full_nameObject



30
31
32
# File 'lib/generators/ifd_tools/install/templates/models/customer.rb', line 30

def full_name
  "#{first_name} #{last_name}"
end

#to_paramObject



38
39
40
# File 'lib/generators/ifd_tools/install/templates/models/customer.rb', line 38

def to_param
  url
end