Lecture 3 - Models, DB, CRUD
# Variables
year = 1993
shape = "square"
# Class
class User
def initialize(age, email)
@age = age
@email = email
end
def email
@email
end
# shortcut
attr_accessor :age
def birthday()
@age += 1
end
end
>> Wonjun = User.new(99, "old@old.com")
>> Wonjun.age
=> 99
>> Wonjun.birthday()
>> Wonjun.age
=> 100
class <classname> < ActiveRecord::Base
Rails is magic
Future Lectures:
Today we'll focus on
Live Demo
Warm ups:
Work Time: