The document provides information about Ruby on Rails including:
- An outline discussing Ruby on Rails, Active Record, and coding practices in Rails
- Statistics showing the growth of Rails from 2005 to 2006 and comparisons to other frameworks like Java
- Descriptions of key aspects of Rails like MVC, conventions over configuration, and Active Record
35. Active Record
• Rails
• ORM
• Convention over Configuration
• 1:1 1:m n:m
• MySQL SQL Server Oracle
SQLite
36. ORM Example
a = People.new
People
id int a = People.find(1)
name varchar
phone varchar a.name = ‘David’
address text a.destroy
sex enum
a.save
37. Relation Table Example
Article
People
id int id int
name varchar person_id int
phone varchar title varchar
address text
content text
sex enum
created_at datatime
38. Relation ORM
a = People.find(1)
a.articles
a.articles.find(:first)
a.articles << Article.new(...)
Person a
47. function (A B {
if( B A ){
return ‘ ’
}else{
for ( A C {
if( B C {
return ‘ ’
}
}
return ‘ ’
Pseudo Code
}
}
48. def check ( city_a , city_b )
if ( city_a.neighbors.include?(city_b)
return ‘ ’
else
city_a.neighbors.each do | neighbor_of_a |
if (neighbor_of_a.neighbors.include?(city_b) )
return ‘ ’
end
end
return ‘ ’
Rails Code
end
end