Introduction to rails

27
Introduction to Web Development Using Rails Chhorn Chamnap 4 August 2012

Transcript of Introduction to rails

Page 1: Introduction to rails

Introduction to Web Development Using Rails

Chhorn Chamnap4 August 2012

Page 2: Introduction to rails

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

What is Rails?

Page 4: Introduction to rails

+ =

Page 5: Introduction to rails

Websites on Rails

Page 6: Introduction to rails

Companies using Rails

Page 7: Introduction to rails

Version History

Page 8: Introduction to rails

The Framework

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

Page 9: Introduction to rails

The Framework (MVC)

Page 10: Introduction to rails
Page 11: Introduction to rails

ActiveRecord

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

Page 12: Introduction to rails

ActiveRecord::Base

Page 13: Introduction to rails

Validation

Page 14: Introduction to rails

has_one

Page 15: Introduction to rails

has_many

Page 16: Introduction to rails

belongs_to

Page 17: Introduction to rails

has_many :through

Page 18: Introduction to rails

Associations

Page 19: Introduction to rails

Fat Models

Page 20: Introduction to rails
Page 21: Introduction to rails

ActionController

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

Page 22: Introduction to rails

ActionController

Page 23: Introduction to rails
Page 24: Introduction to rails

ActionView

Page 25: Introduction to rails

action.mimetype.renderer

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

Page 26: Introduction to rails

Live Demo

Page 27: Introduction to rails

Questions?