introduction to rails
TRANSCRIPT
![Page 1: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/1.jpg)
Introduction to Web Development Using Rails
Chhorn Chamnap4 August 2012
![Page 2: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/2.jpg)
Who Am I?
● Software Engineer from Yoolk Inc.● The author of the gem 'active_record_uuid'● Blog: http://chamnap.github.com/● Twitter: @chamnap● Email: [email protected]
![Page 3: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/3.jpg)
What is Rails?
![Page 4: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/4.jpg)
+ =
![Page 5: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/5.jpg)
Websites on Rails
![Page 6: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/6.jpg)
Companies using Rails
![Page 7: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/7.jpg)
Version History
![Page 8: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/8.jpg)
The Framework
● Convention over Configuration (CoC)● Don't Repeat Yourself (DRY)● Model View Controller (MVC)
![Page 9: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/9.jpg)
The Framework (MVC)
![Page 10: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/10.jpg)
![Page 11: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/11.jpg)
ActiveRecord
● Object Relational Mapping (ORM)● Class to Table, Object to Row● CRUD simple● Database Agnostic
![Page 12: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/12.jpg)
ActiveRecord::Base
![Page 13: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/13.jpg)
Validation
![Page 14: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/14.jpg)
has_one
![Page 15: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/15.jpg)
has_many
![Page 16: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/16.jpg)
belongs_to
![Page 17: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/17.jpg)
has_many :through
![Page 18: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/18.jpg)
Associations
![Page 19: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/19.jpg)
Fat Models
![Page 20: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/20.jpg)
![Page 21: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/21.jpg)
ActionController
● Separation of business logic and presentation● Ideally there should be no logic in the view
![Page 22: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/22.jpg)
ActionController
![Page 23: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/23.jpg)
![Page 24: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/24.jpg)
ActionView
![Page 25: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/25.jpg)
action.mimetype.renderer
● show.html.erb● index.rss.builder● edit.iphone.haml
![Page 26: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/26.jpg)
Live Demo
![Page 27: Introduction to rails](https://reader033.vdocuments.us/reader033/viewer/2022060106/55493dcdb4c905054d8b4dd6/html5/thumbnails/27.jpg)
Questions?