SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Apikit in studio
Apikit in studioApikit in studio
Apikit in studiofedefortin
 
Apidd Member Management
Apidd Member ManagementApidd Member Management
Apidd Member Managementapidd
 
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
 
Winter '19 release development.ppt
Winter '19 release development.pptWinter '19 release development.ppt
Winter '19 release development.pptKailas Shimpi
 
ApiDD Overview
ApiDD OverviewApiDD Overview
ApiDD Overviewapidd
 
Introduction To Ruby On Rails
Introduction To Ruby On RailsIntroduction To Ruby On Rails
Introduction To Ruby On RailsSteve 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 RestangularJohn Schmidt
 
Integrate Jenkins with S3
Integrate Jenkins with S3Integrate Jenkins with S3
Integrate Jenkins with S3devopsjourney
 
Akka Presentation Schule@synyx
Akka Presentation Schule@synyxAkka Presentation Schule@synyx
Akka Presentation Schule@synyxFlorian 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 AppFITC
 
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 EngineRonny 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 overviewMaxim 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
 

Tendances (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
 

Similaire à RBC Mod 1: Making a New Rails App

Rails
RailsRails
RailsSHC
 
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 Railsanides
 
Rails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - BloggerRails Rookies Bootcamp - Blogger
Rails Rookies Bootcamp - BloggerNathanial McConnell
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2Rory Gianni
 
Migration from Rails2 to Rails3
Migration from Rails2 to Rails3Migration from Rails2 to Rails3
Migration from Rails2 to Rails3Umair Amjad
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction Tran Hung
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails SiddheshSiddhesh Bhobe
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails DevsDiacode
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on Railselpizoch
 
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 FrameworkEdureka!
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on RailsAlessandro DS
 

Similaire à 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
 

Dernier

Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptrcbcrtm
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 

Dernier (20)

Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.ppt
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 

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