Download presentation
Presentation is loading. Please wait.
Published byVeronica Holt Modified over 9 years ago
1
Why rails? Carlos Kirkconnell
2
Google
3
Happiness leads to Productivity Happiness Matters
4
“Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to make programmers happy.” Yukihiro Matsumoto “Ruby makes me happy because it allows me to write beautiful code. Aesthetics are strongly linked to enjoyment. It’s not just about getting the job done”.David Heinemeier Hansson
5
“You can recognize truth by its beauty and simplicity. When you get it right, it is obvious that it is right.” Richard Feynman, Scientist
6
Account.transaction(carlos, vera) do carlos.withdraw(100) vera.deposit(100) end
8
class Account < ActiveRecord::Base end
10
class Account :create validates_confirmation_of :password, :email_address, :on => :create end
11
class Project < ActiveRecord::Base belongs_to :portfolio has_one :project_manager has_many :milestones has_and_belongs_to_many :categories end
12
class Project 'Person' has_many :milestones, :dependent => true has_and_belongs_to_many :categories, :join_table => 'categorizations' end
13
class Account "Gordon" person.last_name # => "Freeman"
14
class Post ["body = ?", query]) end end # SELECT * FROM comments WHERE post_id = 1 AND body = 'hi' greetings = Post.find(1).comments.search('hi')
15
Real MVC Model Controll er View.htmlView.xmlView.atom
16
class PhotographersController @photographers } end end # GET /photographers/1 # GET /photographers/1.xml def show @photographer = Photographer.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @photographer } end end end
17
createread updat e delete postgetputdelete insertselect delete HTTP Active Record SQL REST
18
REST It’s all about CRUD
19
class Plan < ActiveRecord::Base has_and_belongs_to_many :users end class User < ActiveRecord::Base has_and_belongs_to_many :plans end
20
class Plan :subscriptions end class User :subscriptions end class Subscription < ActiveRecord::Base belongs_to :user belongs_to :plan validates_presence_of :subscription_date end
21
Rails is RESTful by default we get a free HTTP API support for multiple mime types simpler controllers a better designed model
22
All controllers have 7 actions index => GET /photographers show => GET /photographers/2 new => GET /photographers/new edit => GET /photographers/2/edit create => POST /photographers update => PUT /photographers/2 delete => DELETE /photographers/2
23
page[:graph].src = graph_path(@sync.burndown_id) page.replace_html :notice, flash[:notice] flash.discard page.visual_effect :shake, :graph RJS and Ajax
24
Rails invites you to... write unit, functional & integration tests use design patterns (Active Record, MVC, Observers) work on different environments (development, test, production) use migrations to manage db changes validate forms log errors
25
At the cost of... speed, ruby is interpreted... no intellisense no dialogs, wizards, or IDE learning a lot about html and css
26
Quesions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.