SlideShare uma empresa Scribd logo
1 de 66
Baixar para ler offline
me
http://shinydevelopment.com
Hype
“Ruby on Rails is astounding. Using it is like
watching a kung-fu movie, where a dozen
bad-ass frameworks prepare to beat up the
little newcomer only to be handed their
asses in a variety of imaginative ways.”
                                          Nathan Torkington
“Powerful web applications that
formerly might have taken weeks or
months to develop can be produced
in a matter of days.”
                               Tim O'Reilly
What is
Ruby on Rails?
Ruby    Language
              C# or VB.NET

 on
Rails   Framework
                   ASP.NET
Ruby
Ruby is
Object Oriented
> 2.next
=> 3

> “Hello”.reverse
=> “olleH”

> 2.class
=> Fixnum

> 2.class.class
=> Class
> 2.class
=> Fixnum

> 2.class.superclass
=> Integer

> 2.class.superclass.superclass
=> Numeric

> 2.class.superclass.superclass.superclass
=> Object
Ruby is Readable
> 5.times { print quot;Hello quot; }
Hello Hello Hello Hello Hello

> print “Stuff” unless x.nil?
=> Stuff

> [3, 5, 78, 2, 43].sort.reverse
=> [78, 43, 5, 3, 2]

> 2.weeks.from_now.utc
=> Wed Dec 27 11:25:06 UTC 2006
> [1, 2].empty?
=> false

> x.nil?
=> true
> arr = [5, 4, 3]

> arr.sort
=> [3, 4, 5]   # arr is still [5, 4, 3]

> arr.sort!
=> [3, 4, 5]   # arr is now [3, 4, 5]
Ruby is Dynamic
> Linguistics::use(:en)



> quot;runsquot;.en.present_participle
=> quot;runningquot;

> 5.en.ordinal
=> quot;5thquot;

> quot;cowquot;.en.quantify(1005)
=> quot;thousands of cowsquot;
> animals = %w{dog cow ox chicken goose goat
cow dog rooster llama pig goat dog cat cat dog
cow goat goose goose ox alpaca}

> puts quot;The farm has quot; + animals.en.conjunction

=> “The farm has four dogs, three cows, three
geese, three goats, two oxen, two cats, a
chicken, a rooster, a llama, a pig, and an
alpaca”
class ReverseString

  def method_missing(method_name)
    return method_name.to_s.reverse
  end

end



> s = ReverseString.new
> s.Hello_World
=> “dlroW_olleH”
Rails
“Ruby on Rails is an opinionated framework
     for developing web applications”
Convention
   over
Configuration
Model   Controller   View
ActiveRecord                ActionPack
                Model                   View & Controller




ActiveSupport           JavaScript Libraries
                                Prototype & Script.aculo.us




ActionMailer            ActionWebService
Convention
   over
Configuration
Table                  Class

   groups                 Group


   people                 Person
                 string.pluralize




ABC_usrdetails              User
                 table_name_prefix “ABC_”
                 set_table_name “usrdetails”
Dynamic Scaffolding
  and Validations
                demo
Magic?
scaffold :customer
Ruby is Dynamic
Hey, have you
seen my new
  Rails app?

        I can
      imagine!
       *sigh*
script / generate
More Magic?
Routing
URL
http://localhost:3000/customer/show/2




Routes.rb
map.connect ':controller/:action/:id'
ActiveRecord
“The essence of an Active Record is a domain
model in which the classes match very closely
the record structure of an underlying database.
Each active record is responsible for saving and
loading to the database and also for any domain
logic that acts on the database”
                                           Martin Fowler
ActiveRecord                 ActionPack
                 Model                   View & Controller

        MySQL
      PostgreSQL
ActiveSupport            JavaScript Libraries
     MS SQL - ADO                Prototype & Script.aculo.us

    MS SQL - ODBC
        Oracle
ActionMailer             ActionWebService
      SQLite
         DB2
class Customer < ActiveRecord::Base
   end


>> Customer.column_names
=> [quot;idquot;, quot;namequot;, quot;emailquot;, quot;notesquot;]

>> Customer.columns_hash[quot;idquot;]
=> default=nil, text=false, null=false,
sql_type=quot;int(11)quot;, primary=true,
name=quot;idquot;, type=:integer, number=true
class Customer < ActiveRecord::Base
   end


Customer.find(:all)

Customer.find(1)

Customer.find_by_email(‘bill@example.com’)

Customer.find_by_email_or_name(
                ‘bill@example.com’, ‘Ben’)
class Customer < ActiveRecord::Base
end


  Customer.new do |c|
    c.email = ‘bill@example.com’
    c.name = ‘Bill’
    c.save
  end

  Customer.delete(1)
ActiveRecord
Relationships
Describe the
     relationship
“A customer has many orders and
 an order belongs to a customer.”
has_many
belongs_to
Database
Relationships
            demo
More Magic?
Ruby is Dynamic
Orders
                  id
Customers
            customer_id
   id
                item
 name
 email        quantity
 notes       unit_price
customer = Customer.find(params[:id])
customer.orders.create(params[:order])
Migrations
         demo
Capistrano
What next?
Try Ruby
http://tryruby.hobix.com
Instant Rails
http://instantrails.rubyforge.org
Locomotive
http://locomotive.raaum.org/
SubSonic
http://www.codeplex.com/Wiki/View.aspx?
        ProjectName=actionpackext




Castle Project
      http://www.castleproject.org/
IronRuby
Newcastle Ruby on Rails
    User Group
Thank You
dave.verwer@shinydevelopment.com
Ruby on Rails For .Net Programmers

Mais conteúdo relacionado

Mais procurados

Using Amazon Simple Db With Rails
Using Amazon Simple Db With RailsUsing Amazon Simple Db With Rails
Using Amazon Simple Db With Rails
Akhil Bansal
 
Database presentation
Database presentationDatabase presentation
Database presentation
webhostingguy
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
Yehuda Katz
 
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendallRubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendall
tutorialsruby
 

Mais procurados (20)

Php summary
Php summaryPhp summary
Php summary
 
Mysql & Php
Mysql & PhpMysql & Php
Mysql & Php
 
Rails2 Pr
Rails2 PrRails2 Pr
Rails2 Pr
 
Couchbase & FTS
Couchbase & FTSCouchbase & FTS
Couchbase & FTS
 
NyaruDBにゃるものを使ってみた話 (+Realm比較)
NyaruDBにゃるものを使ってみた話 (+Realm比較)NyaruDBにゃるものを使ってみた話 (+Realm比較)
NyaruDBにゃるものを使ってみた話 (+Realm比較)
 
Using Amazon Simple Db With Rails
Using Amazon Simple Db With RailsUsing Amazon Simple Db With Rails
Using Amazon Simple Db With Rails
 
Rails 3 Beautiful Code
Rails 3 Beautiful CodeRails 3 Beautiful Code
Rails 3 Beautiful Code
 
Omnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the ThingsOmnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the Things
 
Data models in Angular 1 & 2
Data models in Angular 1 & 2Data models in Angular 1 & 2
Data models in Angular 1 & 2
 
Full Stack Scala
Full Stack ScalaFull Stack Scala
Full Stack Scala
 
Workshop 6: Designer tools
Workshop 6: Designer toolsWorkshop 6: Designer tools
Workshop 6: Designer tools
 
Database presentation
Database presentationDatabase presentation
Database presentation
 
Puppet Camp DC 2015: Stop Writing Puppet Modules: A Guide to Best Practices i...
Puppet Camp DC 2015: Stop Writing Puppet Modules: A Guide to Best Practices i...Puppet Camp DC 2015: Stop Writing Puppet Modules: A Guide to Best Practices i...
Puppet Camp DC 2015: Stop Writing Puppet Modules: A Guide to Best Practices i...
 
Full Stack Toronto - the 3R Stack
Full Stack Toronto - the 3R StackFull Stack Toronto - the 3R Stack
Full Stack Toronto - the 3R Stack
 
Rails 3.1 Asset Pipeline
Rails 3.1 Asset PipelineRails 3.1 Asset Pipeline
Rails 3.1 Asset Pipeline
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
 
Rails3 way
Rails3 wayRails3 way
Rails3 way
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
 
Rails3 changesets
Rails3 changesetsRails3 changesets
Rails3 changesets
 
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendallRubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendall
 

Destaque

Latvijas bibliotēku portāls
Latvijas bibliotēku portālsLatvijas bibliotēku portāls
Latvijas bibliotēku portāls
Jānis Ziediņš
 

Destaque (14)

Netzwerken in Sozialen Netzwerken
Netzwerken in Sozialen NetzwerkenNetzwerken in Sozialen Netzwerken
Netzwerken in Sozialen Netzwerken
 
Unobtrusive JavaScript
Unobtrusive JavaScriptUnobtrusive JavaScript
Unobtrusive JavaScript
 
Latvijas bibliotēku portāls
Latvijas bibliotēku portālsLatvijas bibliotēku portāls
Latvijas bibliotēku portāls
 
Openstreetmap im Tourismus
Openstreetmap im TourismusOpenstreetmap im Tourismus
Openstreetmap im Tourismus
 
iPad Interface Design
iPad Interface DesigniPad Interface Design
iPad Interface Design
 
BibLog.lv
BibLog.lvBibLog.lv
BibLog.lv
 
Hand Hygiene
Hand HygieneHand Hygiene
Hand Hygiene
 
EBD Course: Lecture 4 Secondary Sources
EBD Course: Lecture 4 Secondary SourcesEBD Course: Lecture 4 Secondary Sources
EBD Course: Lecture 4 Secondary Sources
 
Chain of infection ash
Chain of infection  ashChain of infection  ash
Chain of infection ash
 
Web2.0 Basics für den Grünen Wahlkampf Wien 2010
Web2.0 Basics für den Grünen Wahlkampf Wien 2010Web2.0 Basics für den Grünen Wahlkampf Wien 2010
Web2.0 Basics für den Grünen Wahlkampf Wien 2010
 
Das Social Web verstehen und nutzen
Das Social Web verstehen und nutzenDas Social Web verstehen und nutzen
Das Social Web verstehen und nutzen
 
Dr. Brian Payne - Infection Chain Concept
Dr. Brian Payne - Infection Chain ConceptDr. Brian Payne - Infection Chain Concept
Dr. Brian Payne - Infection Chain Concept
 
Openstreetmap BarCamp Wien
Openstreetmap BarCamp WienOpenstreetmap BarCamp Wien
Openstreetmap BarCamp Wien
 
Infection Control
Infection ControlInfection Control
Infection Control
 

Semelhante a Ruby on Rails For .Net Programmers

Web aplikāciju izstrāde ar Ruby on Rails un Oracle DB
Web aplikāciju izstrāde ar Ruby on Rails un Oracle DBWeb aplikāciju izstrāde ar Ruby on Rails un Oracle DB
Web aplikāciju izstrāde ar Ruby on Rails un Oracle DB
Raimonds Simanovskis
 
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
Raimonds Simanovskis
 
Ruby on Rails Oracle adaptera izstrāde
Ruby on Rails Oracle adaptera izstrādeRuby on Rails Oracle adaptera izstrāde
Ruby on Rails Oracle adaptera izstrāde
Raimonds Simanovskis
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 

Semelhante a Ruby on Rails For .Net Programmers (20)

Rails on Oracle 2011
Rails on Oracle 2011Rails on Oracle 2011
Rails on Oracle 2011
 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - Keynote
 
Oracle adapters for Ruby ORMs
Oracle adapters for Ruby ORMsOracle adapters for Ruby ORMs
Oracle adapters for Ruby ORMs
 
Web aplikāciju izstrāde ar Ruby on Rails un Oracle DB
Web aplikāciju izstrāde ar Ruby on Rails un Oracle DBWeb aplikāciju izstrāde ar Ruby on Rails un Oracle DB
Web aplikāciju izstrāde ar Ruby on Rails un Oracle DB
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
Extending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsExtending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on Rails
 
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
 
Ruby on Rails Oracle adaptera izstrāde
Ruby on Rails Oracle adaptera izstrādeRuby on Rails Oracle adaptera izstrāde
Ruby on Rails Oracle adaptera izstrāde
 
Scala active record
Scala active recordScala active record
Scala active record
 
Road to Rails
Road to RailsRoad to Rails
Road to Rails
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web Frameworks
 
Php classes in mumbai
Php classes in mumbaiPhp classes in mumbai
Php classes in mumbai
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
DataMapper
DataMapperDataMapper
DataMapper
 
Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007
 
Ruby on Rails ステップアップ講座 - 大場寧子
Ruby on Rails ステップアップ講座 - 大場寧子Ruby on Rails ステップアップ講座 - 大場寧子
Ruby on Rails ステップアップ講座 - 大場寧子
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Introduction to Active Record - Silicon Valley Ruby Conference 2007
Introduction to Active Record - Silicon Valley Ruby Conference 2007Introduction to Active Record - Silicon Valley Ruby Conference 2007
Introduction to Active Record - Silicon Valley Ruby Conference 2007
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Ruby on Rails For .Net Programmers