Ride on the Fast Track of Web with Ruby on Rails- Part 1
-
Upload
fuad-omar -
Category
Technology
-
view
2.991 -
download
0
description
Transcript of Ride on the Fast Track of Web with Ruby on Rails- Part 1
Ruby on Rails
Ride on the fast track of web
“Accumulated knowledge of the
world to your fingertip”
“We are the masters
They are the slaves”
2.days.ago =>Thu, 23 Feb 2012 14:11:45 EST -05:00
‘fuad bin omar’.reverse =>ramo nib dauf
‘fuad bin omar’.capitalize =>Fuad bin omar
‘fuad bin omar’.length =>13
+
Convention
Configuration
Over
One Class Per Table
Class User < ActiveRecord::Base
end
Validations
Class User < ActiveRecord::Base
validates_presence_of :login,:name
validates_uniqueness_of :login
end
class User < ActiveRecord::Base
has_many :posts
end
class Post< ActiveRecord::Base
belongs_to :user
end
User.create!(:login => ‘fuad’,
:name => ‘Fuad Omar’)
user = User.new(:login =>
‘fuad’, :name => ‘Fuad Omar’)
user.save!
user = User.new
user.login = ‘fuad’
user.name = ‘Fuad Omar’
user.save!
user = User.first
user = User.find(12)
user = User.find_by_name(‘Fuad’)
posts = user.posts
user = User.find(12)
posts =
user.posts.where(‘created_at >’,
Date.today – 7.days.ago)
posts = posts.order(‘title‘)
user = User.find(1)
user.name = ‘Fuad Bin Omar’
User.save
2,35,000
Fuad Omar Co-Founder, Nascenia IT
www.nascenia.com
www.facebook.com/nascenia
www.linkedin.com/in/fuadomar
@fuadcse
http://www.softexpo.com.bd/technical_details.php?id=9
To see 2nd part of this presentation visit:
http://www.slideshare.net/ashrafuzzaman/riding-on-rails-part-2
Presented At