SlideShare a Scribd company logo
Making a New
Rails App
RailsBridgeChicago Module 1
Ameeda Chowdhury
twitter.com/ameedahc
Create a new app by typing in the terminal command:
$ rails new <appname>
Use the terminal to create and destroy files and directories
for your app
Make a new app ‘railsbridgedogs’
These are the application
files and directories
created - see in terminal
Files generated for ‘railsbridgedogs’
App files & directories in text editor
Ruby Gems
*Gems* are self-contained Ruby programs and libraries
When you make a new app it fetches *gems*.
These gems are specified in your app’s Gemfile.
You need to install the gems specified in your Gemfile.
bundle install Gems
bundle install will not work
unless you’re in the app’s
directory
Installing the Gems listed in Gemfile
bundle-install installs
the dependencies
specified in your
Gemfile.
More bundle install Gems ...
bundle complete
What is Git?
How do we use Git?
What happens when we don’t use Git?
Git is “version control” software that allows you:
1. show the changes that were made to the code over time
2. allows you to backtrack if necessary and undo those changes
3. enables team collaboration on code
Why do we need Git?
Last, commit your files with a name in quotes “...”.
These files, in their current state, will be accessible to
you any time in the future by commit name, no matter what
changes you make (in future commits).
First, initialize an empty git repository
note the output
Then, add all your app’s
files to the git repo
How do we use Git?
So… what is one object or thing you want users to be
able to access for your dog adoption app?
Resource is any object you want users to be able to
create, read, update, or delete by visiting its URL
Dog Resource!
A Rails
scaffold
quickly generates
a complete set of
files with basic code
for the named
resource
The 4 most important
scaffolded files for Dog
1. Database migrations
2. Model
3. View
4. Controller
Scaffold Dog Resource!
A database is needed to to store
any dog records we create.
We created a database on the
local machine.
Migration files allow you to modify
the database by adding or removing
tables, columns, and entries.
In this case, the migration file
produced by the Dog scaffold
is run, and the Dog table is created.
Databases & Rails Migrations
Databases & Rails Migrations
...maps to the name attribute of instances of your Dog model.
$ rails console let’s you interact with
your application from your terminal’s
command line.
The name database
column of each row of
your Dog table ...
The Dog model file will let
you manipulate data stored
in the dog database table.
The Dog model represents
the data the logic of dog
objects.
Rails Migrations -> Model!
The DogsController
controller file processes
the webserver’s requests
and makes the Dog model’
s data available to the
views.
Controller --> Model data in Views
Run a local webserver to see your webpages run
visit http://localhost:3000/dogs
This is showing us the app/views/dogs/index page
This page is empty because we
have not saved any dogs in our
database.
Create a few dogs with names!
Run Rails Server
Create a few dogs through this
form.
The fields for the dog’s name in the
new, edit, show, and index
are there because we included
‘name:string’ in our scaffolding.
Creating through View Forms
@dogs is available in the view.
each pulls out one dog instance at a time from
inside your collection of all dogs @dogs
app/views/dogs/index
@dogs is an instance variable inside the
index method storing the collection of all dogs
pulled from the database
app/controllers/dogs
Connecting Views to Controllers
<%= dog.name %> prints the dog’s name, once for each dog
because it’s inside the loop app/views/dogs/index

More Related Content

What's hot

Apikit in studio
Apikit in studioApikit in studio
Apikit in studio
fedefortin
 
Apidd Member Management
Apidd Member ManagementApidd Member Management
Apidd Member Management
apidd
 
Writing Alexa Voice Skills With NodeJS (with a little IoT)
Writing Alexa Voice Skills With NodeJS (with a little IoT)Writing Alexa Voice Skills With NodeJS (with a little IoT)
Writing Alexa Voice Skills With NodeJS (with a little IoT)
David Janes
 
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Katy Slemon
 
WordPress REST API
WordPress REST APIWordPress REST API
WordPress REST API
Anthony Montalbano
 
Winter '19 release development.ppt
Winter '19 release development.pptWinter '19 release development.ppt
Winter '19 release development.ppt
Kailas Shimpi
 
ApiDD Overview
ApiDD OverviewApiDD Overview
ApiDD Overview
apidd
 
Feratel mapping
Feratel mappingFeratel mapping
Feratel mapping
STIinnsbruck
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On Rails
Steve Keener
 
Consume RESTful APIs with $resource and Restangular
Consume RESTful APIs with $resource and RestangularConsume RESTful APIs with $resource and Restangular
Consume RESTful APIs with $resource and Restangular
John Schmidt
 
Integrate Jenkins with S3
Integrate Jenkins with S3Integrate Jenkins with S3
Integrate Jenkins with S3
devopsjourney
 
Akka Presentation Schule@synyx
Akka Presentation Schule@synyxAkka Presentation Schule@synyx
Akka Presentation Schule@synyx
Florian Hopf
 
The React Cookbook: Advanced Recipes to Level Up Your Next App
The React Cookbook: Advanced Recipes to Level Up Your Next AppThe React Cookbook: Advanced Recipes to Level Up Your Next App
The React Cookbook: Advanced Recipes to Level Up Your Next App
FITC
 
DevJam 2019 - Building an ALEC Time Engine
DevJam 2019 - Building an ALEC Time EngineDevJam 2019 - Building an ALEC Time Engine
DevJam 2019 - Building an ALEC Time Engine
Ronny Trommer
 
What's new in Rails 5 - API Mode & Action Cable overview
What's new in Rails 5 - API Mode & Action Cable overviewWhat's new in Rails 5 - API Mode & Action Cable overview
What's new in Rails 5 - API Mode & Action Cable overview
Maxim Veksler
 
Laravelの良いところ
Laravelの良いところLaravelの良いところ
Laravelの良いところ
fagai
 
Rails: has_many vs has_one
Rails: has_many vs has_oneRails: has_many vs has_one
Rails: has_many vs has_oneShouichi KAMIYA
 

What's hot (20)

Apikit in studio
Apikit in studioApikit in studio
Apikit in studio
 
Apidd Member Management
Apidd Member ManagementApidd Member Management
Apidd Member Management
 
Writing Alexa Voice Skills With NodeJS (with a little IoT)
Writing Alexa Voice Skills With NodeJS (with a little IoT)Writing Alexa Voice Skills With NodeJS (with a little IoT)
Writing Alexa Voice Skills With NodeJS (with a little IoT)
 
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
 
Asp.net controls
Asp.net controlsAsp.net controls
Asp.net controls
 
WordPress REST API
WordPress REST APIWordPress REST API
WordPress REST API
 
Winter '19 release development.ppt
Winter '19 release development.pptWinter '19 release development.ppt
Winter '19 release development.ppt
 
ApiDD Overview
ApiDD OverviewApiDD Overview
ApiDD Overview
 
Feratel mapping
Feratel mappingFeratel mapping
Feratel mapping
 
Dotnetques
DotnetquesDotnetques
Dotnetques
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On Rails
 
Consume RESTful APIs with $resource and Restangular
Consume RESTful APIs with $resource and RestangularConsume RESTful APIs with $resource and Restangular
Consume RESTful APIs with $resource and Restangular
 
Integrate Jenkins with S3
Integrate Jenkins with S3Integrate Jenkins with S3
Integrate Jenkins with S3
 
Akka Presentation Schule@synyx
Akka Presentation Schule@synyxAkka Presentation Schule@synyx
Akka Presentation Schule@synyx
 
The React Cookbook: Advanced Recipes to Level Up Your Next App
The React Cookbook: Advanced Recipes to Level Up Your Next AppThe React Cookbook: Advanced Recipes to Level Up Your Next App
The React Cookbook: Advanced Recipes to Level Up Your Next App
 
DevJam 2019 - Building an ALEC Time Engine
DevJam 2019 - Building an ALEC Time EngineDevJam 2019 - Building an ALEC Time Engine
DevJam 2019 - Building an ALEC Time Engine
 
What's new in Rails 5 - API Mode & Action Cable overview
What's new in Rails 5 - API Mode & Action Cable overviewWhat's new in Rails 5 - API Mode & Action Cable overview
What's new in Rails 5 - API Mode & Action Cable overview
 
Laravelの良いところ
Laravelの良いところLaravelの良いところ
Laravelの良いところ
 
Rails: has_many vs has_one
Rails: has_many vs has_oneRails: has_many vs has_one
Rails: has_many vs has_one
 
Rails introduction
Rails introductionRails introduction
Rails introduction
 

Similar to RBC Mod 1: Making a New Rails App

Rails
RailsRails
RailsSHC
 
Create a new project in ROR
Create a new project in RORCreate a new project in ROR
Create a new project in ROR
akankshita satapathy
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorialsunniboy
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
anides
 
Rails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - BloggerRails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - Blogger
Nathanial McConnell
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
Rory Gianni
 
Supa fast Ruby + Rails
Supa fast Ruby + RailsSupa fast Ruby + Rails
Supa fast Ruby + Rails
Jean-Baptiste Feldis
 
Migration from Rails2 to Rails3
Migration from Rails2 to Rails3Migration from Rails2 to Rails3
Migration from Rails2 to Rails3
Umair Amjad
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction
Tran Hung
 
Rails interview questions
Rails interview questionsRails interview questions
Rails interview questions
Durgesh Tripathi
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
Siddhesh Bhobe
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails Devs
Diacode
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
Jim Jones
 
12 Introduction to Rails
12 Introduction to Rails12 Introduction to Rails
12 Introduction to Rails
Deepak Hagadur Bheemaraju
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on Rails
elpizoch
 
Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails FrameworkBuilding Application with Ruby On Rails Framework
Building Application with Ruby On Rails Framework
Edureka!
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
Alessandro DS
 

Similar to RBC Mod 1: Making a New Rails App (20)

Rails
RailsRails
Rails
 
Create a new project in ROR
Create a new project in RORCreate a new project in ROR
Create a new project in ROR
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
 
Rail3 intro 29th_sep_surendran
Rail3 intro 29th_sep_surendranRail3 intro 29th_sep_surendran
Rail3 intro 29th_sep_surendran
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Rails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - BloggerRails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - Blogger
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
rails.html
rails.htmlrails.html
rails.html
 
rails.html
rails.htmlrails.html
rails.html
 
Supa fast Ruby + Rails
Supa fast Ruby + RailsSupa fast Ruby + Rails
Supa fast Ruby + Rails
 
Migration from Rails2 to Rails3
Migration from Rails2 to Rails3Migration from Rails2 to Rails3
Migration from Rails2 to Rails3
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction
 
Rails interview questions
Rails interview questionsRails interview questions
Rails interview questions
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails Devs
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
 
12 Introduction to Rails
12 Introduction to Rails12 Introduction to Rails
12 Introduction to Rails
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on Rails
 
Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails FrameworkBuilding Application with Ruby On Rails Framework
Building Application with Ruby On Rails Framework
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 

Recently uploaded

Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 

Recently uploaded (20)

Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 

RBC Mod 1: Making a New Rails App

  • 1. Making a New Rails App RailsBridgeChicago Module 1 Ameeda Chowdhury twitter.com/ameedahc
  • 2. Create a new app by typing in the terminal command: $ rails new <appname> Use the terminal to create and destroy files and directories for your app Make a new app ‘railsbridgedogs’
  • 3. These are the application files and directories created - see in terminal Files generated for ‘railsbridgedogs’
  • 4. App files & directories in text editor
  • 5. Ruby Gems *Gems* are self-contained Ruby programs and libraries When you make a new app it fetches *gems*. These gems are specified in your app’s Gemfile. You need to install the gems specified in your Gemfile.
  • 6. bundle install Gems bundle install will not work unless you’re in the app’s directory
  • 7. Installing the Gems listed in Gemfile
  • 8. bundle-install installs the dependencies specified in your Gemfile. More bundle install Gems ...
  • 10. What is Git? How do we use Git? What happens when we don’t use Git? Git is “version control” software that allows you: 1. show the changes that were made to the code over time 2. allows you to backtrack if necessary and undo those changes 3. enables team collaboration on code Why do we need Git?
  • 11. Last, commit your files with a name in quotes “...”. These files, in their current state, will be accessible to you any time in the future by commit name, no matter what changes you make (in future commits). First, initialize an empty git repository note the output Then, add all your app’s files to the git repo How do we use Git?
  • 12. So… what is one object or thing you want users to be able to access for your dog adoption app?
  • 13. Resource is any object you want users to be able to create, read, update, or delete by visiting its URL Dog Resource!
  • 14. A Rails scaffold quickly generates a complete set of files with basic code for the named resource The 4 most important scaffolded files for Dog 1. Database migrations 2. Model 3. View 4. Controller Scaffold Dog Resource!
  • 15. A database is needed to to store any dog records we create. We created a database on the local machine. Migration files allow you to modify the database by adding or removing tables, columns, and entries. In this case, the migration file produced by the Dog scaffold is run, and the Dog table is created. Databases & Rails Migrations
  • 16. Databases & Rails Migrations ...maps to the name attribute of instances of your Dog model. $ rails console let’s you interact with your application from your terminal’s command line. The name database column of each row of your Dog table ...
  • 17. The Dog model file will let you manipulate data stored in the dog database table. The Dog model represents the data the logic of dog objects. Rails Migrations -> Model!
  • 18. The DogsController controller file processes the webserver’s requests and makes the Dog model’ s data available to the views. Controller --> Model data in Views
  • 19. Run a local webserver to see your webpages run visit http://localhost:3000/dogs This is showing us the app/views/dogs/index page This page is empty because we have not saved any dogs in our database. Create a few dogs with names! Run Rails Server
  • 20. Create a few dogs through this form. The fields for the dog’s name in the new, edit, show, and index are there because we included ‘name:string’ in our scaffolding. Creating through View Forms
  • 21. @dogs is available in the view. each pulls out one dog instance at a time from inside your collection of all dogs @dogs app/views/dogs/index @dogs is an instance variable inside the index method storing the collection of all dogs pulled from the database app/controllers/dogs Connecting Views to Controllers <%= dog.name %> prints the dog’s name, once for each dog because it’s inside the loop app/views/dogs/index