SlideShare a Scribd company logo
/ˈruː.bi/ & Rails
AKAICamp #4: Backend
netguru.co
Blazej Hadzik, developer
netguru.co
netguru.co
Ruby is a language.
Rails is a framework.
netguru.co
Ruby is a dynamic, scripting,
object-oriented language...
netguru.co
netguru.co
Metaprogramming
netguru.co
netguru.co
netguru.co
netguru.co
Everything’s an object
netguru.co
:014 > 1.class
=> Fixnum
:015 > (2.2).class
=> Float
:016 > [].class
=> Array
:017 > "AKAI".class
=> String
:018 > nil.class
=> NilClass
:019 > “abc” + “d”
=> “abcd”
netguru.co
Resources
netguru.co
tryruby.org
netguru.co
ruby-warrior
Ruby on Rails
netguru.co
Ruby is open.
Ruby is people.
..so is Rails.
netguru.co
netguru.co
netguru.co
Gems for everything
netguru.co
netguru.co
Google API
OAuth
RSpec
Faker
ActiveAdmin
Gems
Mandrill
RuboCop
CoffeeScript
Bootstrap
facebook
Devise
Twitter
Backbone.JS
Haml, Slim
Mongoid
AWS
What is the most
popular Ruby gem?
netguru.co
Structure
netguru.co
controllers
models
views
routes.rb, database.yml
Gemfile
netguru.co
Active Record
netguru.co
netguru.co
1. What is Active Record?
2. Convention over Configuration
3. Active Record Models
4. CRUD
MVC
netguru.co
1. What is Active Record?
2. Convention over Configuration
3. Active Record Models
4. CRUD
netguru.co
1. What is Active Record?
2. Convention over Configuration
3. Active Record Models
4. CRUD
class Post < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_many :posts
end
:001 > user = User.find(2)
=> #<User id: 2, name: ‘Blazej’>
:002 > user.posts
=> [#<Post id: 1, title: ‘abc’>,
user_id: 2>, #<Post id: 2, title:
‘akai’>, user_id: 2>]
netguru.co
1. What is Active Record?
2. Convention over Configuration
3. Active Record Models
4. CRUD
:001 > u = User.create(name: ‘XYZ’)
:002 > users = User.all
:003 > u.update(name: ‘Abc’)
MVC
netguru.co
controller
model view
browser
DB
routes
web server
netguru.co
netguru.co
http://localhost:3000/
netguru.conetguru.co
127.0.0.1 - GET /index.html HTTP/1.0" 200 2326
netguru.co
get ‘/’, to: ‘welcome#index’
netguru.co
class WelcomeController < ApplicationController
def index
@posts = Post.all
end
end
netguru.co
class Post < ActiveRecord::Base
end
netguru.co
netguru.co
class Post < ActiveRecord::Base
end
netguru.co
class WelcomeController < ApplicationController
def index
@posts = Post.all
end
end
netguru.co
<ul>
<% @posts.each do |post| %>
<li>
<%= post.title %>
</li>
<% end %>
</ul>
netguru.co
<html>
…
<body>
…
<%= yield %>
…
</body>
</html
http://localhost:3000/
netguru.co
http://localhost:3000/
TDD
netguru.co
write specs, run and fail..
netguru.co
..write code, run specs and succeed.
netguru.co
netguru.co
Thanks
blazej.hadzik@netguru.co
netguru.co

More Related Content

Similar to Ruby On Rails Intro

Similar to Ruby On Rails Intro (20)

Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
Make your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On RailsMake your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On Rails
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
 
rubyonrails
rubyonrailsrubyonrails
rubyonrails
 
Bitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRubyBitter Java, Sweeten with JRuby
Bitter Java, Sweeten with JRuby
 
ruby pentest
ruby pentestruby pentest
ruby pentest
 
Ruby On Rails Overview
Ruby On Rails OverviewRuby On Rails Overview
Ruby On Rails Overview
 
Scala : language of the future
Scala : language of the futureScala : language of the future
Scala : language of the future
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
ruby-cocoa
ruby-cocoaruby-cocoa
ruby-cocoa
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Jax keynote
Jax keynoteJax keynote
Jax keynote
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and future
 
Building an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackBuilding an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stack
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executables
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Ruby Programming Language - Introduction
Ruby Programming Language - IntroductionRuby Programming Language - Introduction
Ruby Programming Language - Introduction
 
What lies beneath the beautiful code?
What lies beneath the beautiful code?What lies beneath the beautiful code?
What lies beneath the beautiful code?
 

More from Netguru

Paradygmaty Programowania: Czy Istnieje Najlepszy?
Paradygmaty Programowania: Czy Istnieje Najlepszy?Paradygmaty Programowania: Czy Istnieje Najlepszy?
Paradygmaty Programowania: Czy Istnieje Najlepszy?
Netguru
 

More from Netguru (20)

Hidden Gems in Swift
Hidden Gems in SwiftHidden Gems in Swift
Hidden Gems in Swift
 
KISS Augmented Reality
KISS Augmented RealityKISS Augmented Reality
KISS Augmented Reality
 
Why Would A Programmer Fall In Love With SPA?
Why Would A Programmer Fall In Love With SPA?Why Would A Programmer Fall In Love With SPA?
Why Would A Programmer Fall In Love With SPA?
 
Defining DSL (Domain Specific Language) using Ruby
Defining DSL (Domain Specific Language) using RubyDefining DSL (Domain Specific Language) using Ruby
Defining DSL (Domain Specific Language) using Ruby
 
How To Build Great Relationships With Your Clients
How To Build Great Relationships With Your ClientsHow To Build Great Relationships With Your Clients
How To Build Great Relationships With Your Clients
 
Agile Retrospectives
Agile RetrospectivesAgile Retrospectives
Agile Retrospectives
 
Ruby Rails Overview
Ruby Rails OverviewRuby Rails Overview
Ruby Rails Overview
 
From Birds To Bugs: Testowanie Z Pasją
From Birds To Bugs: Testowanie Z PasjąFrom Birds To Bugs: Testowanie Z Pasją
From Birds To Bugs: Testowanie Z Pasją
 
Communication With Clients Throughout The Project
Communication With Clients Throughout The ProjectCommunication With Clients Throughout The Project
Communication With Clients Throughout The Project
 
Everyday Rails
Everyday RailsEveryday Rails
Everyday Rails
 
Estimation myths debunked
Estimation myths debunkedEstimation myths debunked
Estimation myths debunked
 
Programming Paradigms Which One Is The Best?
Programming Paradigms Which One Is The Best?Programming Paradigms Which One Is The Best?
Programming Paradigms Which One Is The Best?
 
Z 50 do 100 w ciągu roku Jak rekrutować w IT?
Z 50 do 100 w ciągu roku Jak rekrutować w IT?Z 50 do 100 w ciągu roku Jak rekrutować w IT?
Z 50 do 100 w ciągu roku Jak rekrutować w IT?
 
Paradygmaty Programowania: Czy Istnieje Najlepszy?
Paradygmaty Programowania: Czy Istnieje Najlepszy?Paradygmaty Programowania: Czy Istnieje Najlepszy?
Paradygmaty Programowania: Czy Istnieje Najlepszy?
 
Czy Project Manger Musi Być Osobą Techniczną?
Czy Project Manger Musi Być Osobą Techniczną?Czy Project Manger Musi Być Osobą Techniczną?
Czy Project Manger Musi Być Osobą Techniczną?
 
CSS architecture: How To Write Clean & Scalable Code
CSS architecture: How To Write Clean & Scalable CodeCSS architecture: How To Write Clean & Scalable Code
CSS architecture: How To Write Clean & Scalable Code
 
Perfect Project Read Me (in a few steps)
Perfect Project Read Me (in a few steps)Perfect Project Read Me (in a few steps)
Perfect Project Read Me (in a few steps)
 
The Git Basics
The Git BasicsThe Git Basics
The Git Basics
 
From nil to guru: intro to Ruby on Rails
From nil to guru: intro to Ruby on RailsFrom nil to guru: intro to Ruby on Rails
From nil to guru: intro to Ruby on Rails
 
Working With Teams Across The Borders
Working With Teams Across The BordersWorking With Teams Across The Borders
Working With Teams Across The Borders
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 

Recently uploaded (20)

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 

Ruby On Rails Intro