This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/blog.db") | |
class Post | |
include DataMapper::Resource | |
property :id, Serial | |
property :title, String | |
property :body, Text | |
property :created_at, DateTime | |
property :updated_at, DateTime | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student | |
attr_accessor :first_term_home_work, :first_term_test, :first_term_paper attr_accessor, | |
:second_term_home_work, :second_term_test, :second_term_paper | |
def first_term_grade | |
(first_term_home_work + first_term_test + first_term_paper) / 3 | |
end | |
def second_term_grade | |
(second_term_home_work + second_term_test + second_term_paper) / 3 |
NewerOlder