SlideShare una empresa de Scribd logo
1 de 18
One word … Beautiful
 Rails is a web application development
framework written in the Ruby language. It is
designed to make programming web
applications easier by making assumptions
about what every developer needs to get
started.
 DRY – “Don’t Repeat Yourself”
 Convention Over
 REST is the best pattern for web applications
 Rails installer
 Aaaaaaand it is done
 Update using
 Gem update --system
 Gem update
 Model : Data layer
 Views : Presentation layer
 Controller : Linking between mode and views
rails new blog
 cd blog
 rails server
 localhost:3000
 Delete public/index.html
 Generate index page
 rails generate controller home index
 set homepage
 root :to => "home#index"
 Create scaffold along with a model
 rails generate scaffold post name:string
title:string content:text
 rake db:migrate
 Add link to home page
 <%= link_to "My Blog", posts_path %>
 validates :name, :presence => true
 validates :title, :presence => true, :length
=> { :minimum => 5 }
 Create model
 rails generate model comment commenter:string
body:text post:references
 rake db:migrate
 Add repation to post model
 has_many :comments
 Add it as subresource to post
 resources :posts do
 resources :comments
 end
 Create controller
 rails generate controller Comments
 Add a comment:
 <%= form_for([@post,
@post.comments.build]) do |f| %>
 <%= f.label :commenter %>
 <%= f.text_field :commenter %>
 <%= f.label :body %>
 <%= f.text_area :body %>
 <%= f.submit %>
 <% end %>
 @post = Post.find(params[:post_id])
 @comment =
@post.comments.create(params[:comment])
 redirect_to post_path(@post)
 <h2>Comments</h2>
 <% @post.comments.each do |comment| %>
 Commenter: <%= comment.commenter %>
 Comment: <%= comment.body %>
 <br/>
 <% end %>
 Add user name and password
 http_basic_authenticate_with :name => “admin",
:password => “admin", :except => [:index, :show]
 Tags
 Comments moderation
 Images for post
 Attached youtube video to post
 Posts categories
 … what else ?
 Implement new ideas with your team
 Read
 http://haml.info/tutorial.html
 http://haml.info/docs/yardoc/file.REFERENCE.h
tml
Ruby on rails3 - introduction to rails

Más contenido relacionado

La actualidad más candente

ASP.NET Session 9
ASP.NET Session 9ASP.NET Session 9
ASP.NET Session 9
Sisir Ghosh
 

La actualidad más candente (20)

Web Os Hands On
Web Os Hands OnWeb Os Hands On
Web Os Hands On
 
Mule with salesforce push topic notification copy
Mule with salesforce push topic notification   copyMule with salesforce push topic notification   copy
Mule with salesforce push topic notification copy
 
Application Server-less Web Applications - Serverless Toronto Meetup
Application Server-less Web Applications - Serverless Toronto Meetup Application Server-less Web Applications - Serverless Toronto Meetup
Application Server-less Web Applications - Serverless Toronto Meetup
 
Ajax control asp.net
Ajax control asp.netAjax control asp.net
Ajax control asp.net
 
Tutorial asp.net
Tutorial  asp.netTutorial  asp.net
Tutorial asp.net
 
Rails introduction
Rails introductionRails introduction
Rails introduction
 
Pundit
PunditPundit
Pundit
 
API Proxy Auto Discovery
API Proxy Auto DiscoveryAPI Proxy Auto Discovery
API Proxy Auto Discovery
 
Asp.net controls
Asp.net controlsAsp.net controls
Asp.net controls
 
Mule with facebook
Mule with facebookMule with facebook
Mule with facebook
 
ASP.NET Session 9
ASP.NET Session 9ASP.NET Session 9
ASP.NET Session 9
 
ASP.NET Lecture 1
ASP.NET Lecture 1ASP.NET Lecture 1
ASP.NET Lecture 1
 
Anypoint lessons
Anypoint lessonsAnypoint lessons
Anypoint lessons
 
You Know WebOS
You Know WebOSYou Know WebOS
You Know WebOS
 
Asp.net
 Asp.net Asp.net
Asp.net
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with mule
 
Mule
MuleMule
Mule
 
RBC Mod 1: Making a New Rails App
RBC Mod 1: Making a New Rails AppRBC Mod 1: Making a New Rails App
RBC Mod 1: Making a New Rails App
 
Building Cool apps with flex
Building Cool apps with flexBuilding Cool apps with flex
Building Cool apps with flex
 
Introduction to Adobe Flex - Zaloni
Introduction to Adobe Flex - ZaloniIntroduction to Adobe Flex - Zaloni
Introduction to Adobe Flex - Zaloni
 

Destacado

Performance Enhancements In Postgre Sql 8.4
Performance Enhancements In Postgre Sql 8.4Performance Enhancements In Postgre Sql 8.4
Performance Enhancements In Postgre Sql 8.4
HighLoad2009
 
a-beginners-guide-to-namas-web_final
a-beginners-guide-to-namas-web_finala-beginners-guide-to-namas-web_final
a-beginners-guide-to-namas-web_final
Urska Trunk
 

Destacado (20)

Ruby On Rails Introduction
Ruby On Rails IntroductionRuby On Rails Introduction
Ruby On Rails Introduction
 
Quick introduction to Ruby on Rails
Quick introduction to Ruby on RailsQuick introduction to Ruby on Rails
Quick introduction to Ruby on Rails
 
Highcharts
HighchartsHighcharts
Highcharts
 
Dynamic Data Visualization With Chartkick
Dynamic Data Visualization With ChartkickDynamic Data Visualization With Chartkick
Dynamic Data Visualization With Chartkick
 
Postgre sql unleashed
Postgre sql unleashedPostgre sql unleashed
Postgre sql unleashed
 
Load Balancing with Apache
Load Balancing with ApacheLoad Balancing with Apache
Load Balancing with Apache
 
Performance Enhancements In Postgre Sql 8.4
Performance Enhancements In Postgre Sql 8.4Performance Enhancements In Postgre Sql 8.4
Performance Enhancements In Postgre Sql 8.4
 
Elastic search overview
Elastic search overviewElastic search overview
Elastic search overview
 
(SDD423) Elastic Load Balancing Deep Dive and Best Practices | AWS re:Invent ...
(SDD423) Elastic Load Balancing Deep Dive and Best Practices | AWS re:Invent ...(SDD423) Elastic Load Balancing Deep Dive and Best Practices | AWS re:Invent ...
(SDD423) Elastic Load Balancing Deep Dive and Best Practices | AWS re:Invent ...
 
Elasticsearch in 15 minutes
Elasticsearch in 15 minutesElasticsearch in 15 minutes
Elasticsearch in 15 minutes
 
ElasticSearch Basic Introduction
ElasticSearch Basic IntroductionElasticSearch Basic Introduction
ElasticSearch Basic Introduction
 
Ruby on Rails, a brief introduction
Ruby on Rails, a brief introductionRuby on Rails, a brief introduction
Ruby on Rails, a brief introduction
 
Hello world ios v1
Hello world ios v1Hello world ios v1
Hello world ios v1
 
Introduction to Rails
Introduction to RailsIntroduction to Rails
Introduction to Rails
 
Ruby on Rails: a brief introduction
Ruby on Rails: a brief introductionRuby on Rails: a brief introduction
Ruby on Rails: a brief introduction
 
Ruby on rails evaluation
Ruby on rails evaluationRuby on rails evaluation
Ruby on rails evaluation
 
a-beginners-guide-to-namas-web_final
a-beginners-guide-to-namas-web_finala-beginners-guide-to-namas-web_final
a-beginners-guide-to-namas-web_final
 
Beginners Guide for iPhone & iPad
Beginners Guide for iPhone & iPadBeginners Guide for iPhone & iPad
Beginners Guide for iPhone & iPad
 
Introduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman OrtegaIntroduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman Ortega
 
Introduction to Rails
Introduction to RailsIntroduction to Rails
Introduction to Rails
 

Similar a Ruby on rails3 - introduction to rails

Ruby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails frameworkRuby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails framework
Pankaj Bhageria
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
Raed Aldahdooh
 

Similar a Ruby on rails3 - introduction to rails (20)

Web api
Web apiWeb api
Web api
 
Ruby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails frameworkRuby conf 2011, Create your own rails framework
Ruby conf 2011, Create your own rails framework
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
Summit Australia 2019 - PowerApp Portals - Andrew Ly & Lachlan Wright
Summit Australia 2019 - PowerApp Portals - Andrew Ly & Lachlan WrightSummit Australia 2019 - PowerApp Portals - Andrew Ly & Lachlan Wright
Summit Australia 2019 - PowerApp Portals - Andrew Ly & Lachlan Wright
 
Nodejs.meetup
Nodejs.meetupNodejs.meetup
Nodejs.meetup
 
Asp.net
Asp.netAsp.net
Asp.net
 
Useful Rails Plugins
Useful Rails PluginsUseful Rails Plugins
Useful Rails Plugins
 
Rails notification
Rails notificationRails notification
Rails notification
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017 So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails Devs
 
Creating web form
Creating web formCreating web form
Creating web form
 
Creating web form
Creating web formCreating web form
Creating web form
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Ruby on rails3 - introduction to rails

  • 1. One word … Beautiful
  • 2.  Rails is a web application development framework written in the Ruby language. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started.
  • 3.  DRY – “Don’t Repeat Yourself”  Convention Over  REST is the best pattern for web applications
  • 4.  Rails installer  Aaaaaaand it is done  Update using  Gem update --system  Gem update
  • 5.  Model : Data layer  Views : Presentation layer  Controller : Linking between mode and views
  • 7.  cd blog  rails server  localhost:3000
  • 8.  Delete public/index.html  Generate index page  rails generate controller home index  set homepage  root :to => "home#index"
  • 9.  Create scaffold along with a model  rails generate scaffold post name:string title:string content:text  rake db:migrate  Add link to home page  <%= link_to "My Blog", posts_path %>
  • 10.  validates :name, :presence => true  validates :title, :presence => true, :length => { :minimum => 5 }
  • 11.  Create model  rails generate model comment commenter:string body:text post:references  rake db:migrate  Add repation to post model  has_many :comments  Add it as subresource to post  resources :posts do  resources :comments  end  Create controller  rails generate controller Comments
  • 12.  Add a comment:  <%= form_for([@post, @post.comments.build]) do |f| %>  <%= f.label :commenter %>  <%= f.text_field :commenter %>  <%= f.label :body %>  <%= f.text_area :body %>  <%= f.submit %>  <% end %>
  • 13.  @post = Post.find(params[:post_id])  @comment = @post.comments.create(params[:comment])  redirect_to post_path(@post)
  • 14.  <h2>Comments</h2>  <% @post.comments.each do |comment| %>  Commenter: <%= comment.commenter %>  Comment: <%= comment.body %>  <br/>  <% end %>
  • 15.  Add user name and password  http_basic_authenticate_with :name => “admin", :password => “admin", :except => [:index, :show]
  • 16.  Tags  Comments moderation  Images for post  Attached youtube video to post  Posts categories  … what else ?
  • 17.  Implement new ideas with your team  Read  http://haml.info/tutorial.html  http://haml.info/docs/yardoc/file.REFERENCE.h tml