Top Banner
Introduction to Web Development Using Rails Chhorn Chamnap 4 August 2012
27
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introductiontorails 120804023905-phpapp02

Introduction to Web Development Using Rails

Chhorn Chamnap4 August 2012

Page 2: Introductiontorails 120804023905-phpapp02

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: Introductiontorails 120804023905-phpapp02

What is Rails?

Page 4: Introductiontorails 120804023905-phpapp02

+ =

Page 5: Introductiontorails 120804023905-phpapp02

Websites on Rails

Page 6: Introductiontorails 120804023905-phpapp02

Companies using Rails

Page 7: Introductiontorails 120804023905-phpapp02

Version History

Page 8: Introductiontorails 120804023905-phpapp02

The Framework

● Convention over Configuration (CoC)● Don't Repeat Yourself (DRY)● Model View Controller (MVC)

Page 9: Introductiontorails 120804023905-phpapp02

The Framework (MVC)

Page 10: Introductiontorails 120804023905-phpapp02
Page 11: Introductiontorails 120804023905-phpapp02

ActiveRecord

● Object Relational Mapping (ORM)● Class to Table, Object to Row● CRUD simple● Database Agnostic

Page 12: Introductiontorails 120804023905-phpapp02

ActiveRecord::Base

Page 13: Introductiontorails 120804023905-phpapp02

Validation

Page 14: Introductiontorails 120804023905-phpapp02

has_one

Page 15: Introductiontorails 120804023905-phpapp02

has_many

Page 16: Introductiontorails 120804023905-phpapp02

belongs_to

Page 17: Introductiontorails 120804023905-phpapp02

has_many :through

Page 18: Introductiontorails 120804023905-phpapp02

Associations

Page 19: Introductiontorails 120804023905-phpapp02

Fat Models

Page 20: Introductiontorails 120804023905-phpapp02
Page 21: Introductiontorails 120804023905-phpapp02

ActionController

● Separation of business logic and presentation● Ideally there should be no logic in the view

Page 22: Introductiontorails 120804023905-phpapp02

ActionController

Page 23: Introductiontorails 120804023905-phpapp02
Page 24: Introductiontorails 120804023905-phpapp02

ActionView

Page 25: Introductiontorails 120804023905-phpapp02

action.mimetype.renderer

● show.html.erb● index.rss.builder● edit.iphone.haml

Page 26: Introductiontorails 120804023905-phpapp02

Live Demo

Page 27: Introductiontorails 120804023905-phpapp02

Questions?