Class: User

Inherits:
LazyRecord show all
Defined in:
app/models/user.rb

Constant Summary

Constants inherited from LazyRecord

LazyRecord::AssociationNotFound, LazyRecord::RecordNotFound

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LazyRecord

all, all_attributes, #attributes, attributes, belongs_to_attributes, #build_associated, #build_from_params!, db_try, #destroy, find, find_by, inherited, #initialize, method_missing, nested_attributes, tbl_attr_accessor, #update_attributes

Methods inherited from Studio54::Base

require_all_models, require_models

Constructor Details

This class inherits a constructor from LazyRecord

Instance Attribute Details

#emailObject

Returns the value of attribute email.



6
7
8
# File 'app/models/user.rb', line 6

def email
  @email
end

#humorObject

Returns the value of attribute humor.



5
6
7
# File 'app/models/user.rb', line 5

def humor
  @humor
end

Instance Method Details

#age_greater_than_18Object



20
21
22
# File 'app/models/user.rb', line 20

def age_greater_than_18
  errors.add(:age, "must be greater than 18") if self.age.to_i <= 18
end

#drinkObject



28
29
30
31
32
# File 'app/models/user.rb', line 28

def drink
  run_callbacks :drink do
    "mmm"
  end
end

#name_not_blankObject



16
17
18
# File 'app/models/user.rb', line 16

def name_not_blank
  errors.add(:name, "can't be blank") if self.name.blank?
end

#saveObject



39
40
41
42
43
# File 'app/models/user.rb', line 39

def save
  run_callbacks :save do
    super
  end
end