SlideShare a Scribd company logo
1 of 24
Ruby on Rails Server-side web development  VladStoian Victor Porof
What we’ll talk about What is Ruby on Rails? A brief history MVC architecture in a nutshell Distinctive framework features Why Ruby? Why Rails? Demo
What is RoR? Open Source Abstraction providing generic server-side functionality Used for web application development It’s a framework for the Ruby language ..so don’t confuse it with plain Ruby!
A brief history Originates in David Heinemeier Hansson’s work First released in July 2004 Apple ships RoR with Mac OS X Leopard since 2007 Major new developments with v2.3 in 2009 Templates Generate skeleton applications Custom gems and configurations Latest: v3.0.5, 27 February 2011
MVC architecture RoR is based on the Model-View-Controller design It’s an architectural development pattern Widely used in many other frameworks: Oracle Application Framework, Cocoon, JSF (Java) ASP.NET (C#) SproutCore, JavascriptMVC (Javascript) Django, Pylons (Python) CakePHP(PHP) PureMVC (many languages)
MVC on Rails Models are Ruby classes, used to store and validate data Handles migrations They talk to databases MySQL SQLite PostgreSQL NoSQL MongoDB Cassandra “Chubby guy in the back room” crunching the numbers
Model snippet class Person < ActiveRecord::Base validates_presence_of :name has_many :wifes end Person.create(:name => ”Muhammad Ali”).valid? # => true Person.create(:name => nil).valid? # => false
Migration snippet class AddReceiveNewsletterToUsers < ActiveRecord::Migration defself.up change_table :users do |t| t.boolean :receive_newsletter, :default => false     end User.update_all ["receive_newsletter = ?", true]   end defself.down remove_column :users, :receive_newsletter   end end
MVC on Rails What the user sees HTML, CSS, XML, Javascript (jQuery) JSON, RSS, Atom Automatically generated “view-puppets” Visual representation of data Does not have direct access to the model! It shouldn’t do lots of processing or calculation
View snippet  <!-- app/views/items/new.rhtml -->   <%= form_tag :action => “create” %>    Name: <%= text_field“item”, “name”%><br/> Email: <%= text_field“item”, ”email”%><br/>   Password: <%= hidden_field “item”, “password”%><br/>    <%= submit_tag %>   <%= end_form_tag %>
MVC on Rails Gateway between the model and the view Handles user requests Does parsing and data submissions Takes care of sessions, cookies Works out what data to show and what views to render ”The best controller: it gives orders without knowing  (or caring) how it gets done”
Controller snippet classItemsController < ApplicationController     def edit       @item = Item.find(params[:id]) ifrequest.post?          @item.update_attributes(params[:item]) redirect_to :action => 'edit', :id => @item.id       end     end   end
MVC on Rails To summarize: Keep your view code skinny Keep your controller code skinny The fatness is in the model
Distinctive framework features Code generators Awesome built-in functions => rapid development Tons of “gems” to choose from Cross-platform compatibility Automated operation (CRUD) Create, Retrieve, Automate and Delete Simplified testing (Rake script)
Code generator snippet #model generator (general) ruby script/generate model model_name #(in v2.3) rails generate model model_name #(in v3) #model generator (example) rails generate model user name:stringhashed_password:string #controller generator (general) ruby script/generate controller controller_namemethod_name(s)  (in v2.3) rails generate controller controller_namemethod_name(s) (in v3) #controller generator (example) rails generate controller store index
RoR servers Mongrel Webbrick Thin Apache (mod_passanger) ..so it’s very scalable!
Famous projects on Rails Twitter (microblogging) Crunchbase (companies database) BaseCamp (project management) Hulu (online tv) Yellowpages.com (phone database) Xing (business network)
Why Ruby? Interpreted language => greater flexibility Provides JIT (just in time compilation) Garbage collection Able to generate code on the fly Cleaner syntax (no more “Verbose verbose is too verbose for verbose”) Many implementations: Jruby, IronRuby, Rubinius(Ruby + C++), MacRuby (ObjC)
Why Rails? Based on Ruby Easy to implement CGI scripts Rapid web-application development Designed to make programming work easier Less coding, more functionality Thousands of plugins Don’t reinvent the wheel
Creating a blog with
Build a Blog with Ruby on Rails
Build a Blog with Ruby on Rails

More Related Content

What's hot

TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0Shiju Varghese
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9AHM Pervej Kabir
 
Single Page Apps
Single Page AppsSingle Page Apps
Single Page AppsGil Fink
 
Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3Alexandre Malavasi
 
Zend MVC pattern based Framework – Best for Enterprise web applications
Zend MVC pattern based Framework – Best for Enterprise web applicationsZend MVC pattern based Framework – Best for Enterprise web applications
Zend MVC pattern based Framework – Best for Enterprise web applicationsEtisbew Technology Group
 
REPORT ON ASP.NET
REPORT ON ASP.NETREPORT ON ASP.NET
REPORT ON ASP.NETLOKESH
 
Code igniter overview
Code igniter overviewCode igniter overview
Code igniter overviewumesh patil
 
Swagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierSwagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierMiroslav Resetar
 
Entity Framework Core 1.0
Entity Framework Core 1.0Entity Framework Core 1.0
Entity Framework Core 1.0Senthil Kumar
 
What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0Jess Chadwick
 
Angular js presentation at Datacom
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at DatacomDavid Xi Peng Yang
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on RailsMark Menard
 
Ruby on Rails: Building Web Applications Is Fun Again!
Ruby on Rails: Building Web Applications Is Fun Again!Ruby on Rails: Building Web Applications Is Fun Again!
Ruby on Rails: Building Web Applications Is Fun Again!judofyr
 
Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend FrameworkPhil Brown
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfAlfresco Software
 
Kick start your journey as mern stack developer
Kick start your journey as mern stack developerKick start your journey as mern stack developer
Kick start your journey as mern stack developerShrutiPanjwani1
 

What's hot (20)

Angular 4
Angular 4Angular 4
Angular 4
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
 
Require.JS
Require.JSRequire.JS
Require.JS
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
 
Single Page Apps
Single Page AppsSingle Page Apps
Single Page Apps
 
Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3Modern Applications With Asp.net Core 5 and Vue JS 3
Modern Applications With Asp.net Core 5 and Vue JS 3
 
Top java script frameworks ppt
Top java script frameworks pptTop java script frameworks ppt
Top java script frameworks ppt
 
Zend MVC pattern based Framework – Best for Enterprise web applications
Zend MVC pattern based Framework – Best for Enterprise web applicationsZend MVC pattern based Framework – Best for Enterprise web applications
Zend MVC pattern based Framework – Best for Enterprise web applications
 
REPORT ON ASP.NET
REPORT ON ASP.NETREPORT ON ASP.NET
REPORT ON ASP.NET
 
Code igniter overview
Code igniter overviewCode igniter overview
Code igniter overview
 
Swagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierSwagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlier
 
Entity Framework Core 1.0
Entity Framework Core 1.0Entity Framework Core 1.0
Entity Framework Core 1.0
 
What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0What’s New and Hot in .NET 4.0
What’s New and Hot in .NET 4.0
 
Angular js presentation at Datacom
Angular js presentation at DatacomAngular js presentation at Datacom
Angular js presentation at Datacom
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on Rails
 
Ruby on Rails: Building Web Applications Is Fun Again!
Ruby on Rails: Building Web Applications Is Fun Again!Ruby on Rails: Building Web Applications Is Fun Again!
Ruby on Rails: Building Web Applications Is Fun Again!
 
Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend Framework
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
 
Manasa
ManasaManasa
Manasa
 
Kick start your journey as mern stack developer
Kick start your journey as mern stack developerKick start your journey as mern stack developer
Kick start your journey as mern stack developer
 

Viewers also liked

[TW] CSS Files Optimization
[TW] CSS Files Optimization[TW] CSS Files Optimization
[TW] CSS Files OptimizationBogdan Gaza
 
Web Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexWeb Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexBrian Hogan
 
Using Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databasesUsing Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databasesRaimonds Simanovskis
 
Fast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleFast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleRaimonds Simanovskis
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQueryDoncho Minkov
 
Railsチュートリアルの歩き方 (第4版)
Railsチュートリアルの歩き方 (第4版)Railsチュートリアルの歩き方 (第4版)
Railsチュートリアルの歩き方 (第4版)Yohei Yasukawa
 

Viewers also liked (7)

[TW] CSS Files Optimization
[TW] CSS Files Optimization[TW] CSS Files Optimization
[TW] CSS Files Optimization
 
Web Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To ComplexWeb Development With Ruby - From Simple To Complex
Web Development With Ruby - From Simple To Complex
 
Using Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databasesUsing Ruby on Rails with legacy Oracle databases
Using Ruby on Rails with legacy Oracle databases
 
Fast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on OracleFast Web Applications Development with Ruby on Rails on Oracle
Fast Web Applications Development with Ruby on Rails on Oracle
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
 
Railsチュートリアルの歩き方 (第4版)
Railsチュートリアルの歩き方 (第4版)Railsチュートリアルの歩き方 (第4版)
Railsチュートリアルの歩き方 (第4版)
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 

Similar to Build a Blog with Ruby on Rails

Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsVictor Porof
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government DevelopersFrank La Vigne
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web DevelopmentSonia Simi
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Railscodeinmotion
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)Daniel Bryant
 
The web as it should be
The web as it should beThe web as it should be
The web as it should bethebeebs
 
ruby on rails development company in india
ruby on rails development company in indiaruby on rails development company in india
ruby on rails development company in indiaSAG IPL
 
Ruby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupRuby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupJose de Leon
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsAgnieszka Figiel
 
Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022NAVER D2
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)Hatem Hamad
 
Teaching old java script new tricks
Teaching old java script new tricksTeaching old java script new tricks
Teaching old java script new tricksSimon Sturmer
 
Ram Kumar - Sr. Certified Mule ESB Integration Developer
Ram Kumar - Sr. Certified Mule ESB Integration DeveloperRam Kumar - Sr. Certified Mule ESB Integration Developer
Ram Kumar - Sr. Certified Mule ESB Integration DeveloperRam Kumar
 
Web Development Today
Web Development TodayWeb Development Today
Web Development Todaybretticus
 
Full stack Java Developer
Full stack Java DeveloperFull stack Java Developer
Full stack Java DeveloperMdHasan872214
 

Similar to Build a Blog with Ruby on Rails (20)

Beginners' guide to Ruby on Rails
Beginners' guide to Ruby on RailsBeginners' guide to Ruby on Rails
Beginners' guide to Ruby on Rails
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
Asp.Net MVC3 - Basics
Asp.Net MVC3 - BasicsAsp.Net MVC3 - Basics
Asp.Net MVC3 - Basics
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
 
The web as it should be
The web as it should beThe web as it should be
The web as it should be
 
ruby on rails development company in india
ruby on rails development company in indiaruby on rails development company in india
ruby on rails development company in india
 
Ruby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User GroupRuby On Rails - Rochester K Linux User Group
Ruby On Rails - Rochester K Linux User Group
 
Ruby on rails for beginers
Ruby on rails for beginersRuby on rails for beginers
Ruby on rails for beginers
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
 
CG_CS25010_Lecture
CG_CS25010_LectureCG_CS25010_Lecture
CG_CS25010_Lecture
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022Deview 2013 mobile browser internals and trends_20131022
Deview 2013 mobile browser internals and trends_20131022
 
ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)ASP.net MVC Introduction Wikilogia (nov 2014)
ASP.net MVC Introduction Wikilogia (nov 2014)
 
Teaching old java script new tricks
Teaching old java script new tricksTeaching old java script new tricks
Teaching old java script new tricks
 
Ram Kumar - Sr. Certified Mule ESB Integration Developer
Ram Kumar - Sr. Certified Mule ESB Integration DeveloperRam Kumar - Sr. Certified Mule ESB Integration Developer
Ram Kumar - Sr. Certified Mule ESB Integration Developer
 
Web Development Today
Web Development TodayWeb Development Today
Web Development Today
 
Full stack Java Developer
Full stack Java DeveloperFull stack Java Developer
Full stack Java Developer
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Build a Blog with Ruby on Rails

  • 1. Ruby on Rails Server-side web development VladStoian Victor Porof
  • 2. What we’ll talk about What is Ruby on Rails? A brief history MVC architecture in a nutshell Distinctive framework features Why Ruby? Why Rails? Demo
  • 3. What is RoR? Open Source Abstraction providing generic server-side functionality Used for web application development It’s a framework for the Ruby language ..so don’t confuse it with plain Ruby!
  • 4. A brief history Originates in David Heinemeier Hansson’s work First released in July 2004 Apple ships RoR with Mac OS X Leopard since 2007 Major new developments with v2.3 in 2009 Templates Generate skeleton applications Custom gems and configurations Latest: v3.0.5, 27 February 2011
  • 5. MVC architecture RoR is based on the Model-View-Controller design It’s an architectural development pattern Widely used in many other frameworks: Oracle Application Framework, Cocoon, JSF (Java) ASP.NET (C#) SproutCore, JavascriptMVC (Javascript) Django, Pylons (Python) CakePHP(PHP) PureMVC (many languages)
  • 6.
  • 7. MVC on Rails Models are Ruby classes, used to store and validate data Handles migrations They talk to databases MySQL SQLite PostgreSQL NoSQL MongoDB Cassandra “Chubby guy in the back room” crunching the numbers
  • 8. Model snippet class Person < ActiveRecord::Base validates_presence_of :name has_many :wifes end Person.create(:name => ”Muhammad Ali”).valid? # => true Person.create(:name => nil).valid? # => false
  • 9. Migration snippet class AddReceiveNewsletterToUsers < ActiveRecord::Migration defself.up change_table :users do |t| t.boolean :receive_newsletter, :default => false end User.update_all ["receive_newsletter = ?", true] end defself.down remove_column :users, :receive_newsletter end end
  • 10. MVC on Rails What the user sees HTML, CSS, XML, Javascript (jQuery) JSON, RSS, Atom Automatically generated “view-puppets” Visual representation of data Does not have direct access to the model! It shouldn’t do lots of processing or calculation
  • 11. View snippet <!-- app/views/items/new.rhtml --> <%= form_tag :action => “create” %> Name: <%= text_field“item”, “name”%><br/> Email: <%= text_field“item”, ”email”%><br/> Password: <%= hidden_field “item”, “password”%><br/> <%= submit_tag %> <%= end_form_tag %>
  • 12. MVC on Rails Gateway between the model and the view Handles user requests Does parsing and data submissions Takes care of sessions, cookies Works out what data to show and what views to render ”The best controller: it gives orders without knowing (or caring) how it gets done”
  • 13. Controller snippet classItemsController < ApplicationController def edit @item = Item.find(params[:id]) ifrequest.post? @item.update_attributes(params[:item]) redirect_to :action => 'edit', :id => @item.id end end end
  • 14. MVC on Rails To summarize: Keep your view code skinny Keep your controller code skinny The fatness is in the model
  • 15. Distinctive framework features Code generators Awesome built-in functions => rapid development Tons of “gems” to choose from Cross-platform compatibility Automated operation (CRUD) Create, Retrieve, Automate and Delete Simplified testing (Rake script)
  • 16. Code generator snippet #model generator (general) ruby script/generate model model_name #(in v2.3) rails generate model model_name #(in v3) #model generator (example) rails generate model user name:stringhashed_password:string #controller generator (general) ruby script/generate controller controller_namemethod_name(s) (in v2.3) rails generate controller controller_namemethod_name(s) (in v3) #controller generator (example) rails generate controller store index
  • 17. RoR servers Mongrel Webbrick Thin Apache (mod_passanger) ..so it’s very scalable!
  • 18. Famous projects on Rails Twitter (microblogging) Crunchbase (companies database) BaseCamp (project management) Hulu (online tv) Yellowpages.com (phone database) Xing (business network)
  • 19. Why Ruby? Interpreted language => greater flexibility Provides JIT (just in time compilation) Garbage collection Able to generate code on the fly Cleaner syntax (no more “Verbose verbose is too verbose for verbose”) Many implementations: Jruby, IronRuby, Rubinius(Ruby + C++), MacRuby (ObjC)
  • 20. Why Rails? Based on Ruby Easy to implement CGI scripts Rapid web-application development Designed to make programming work easier Less coding, more functionality Thousands of plugins Don’t reinvent the wheel
  • 21.