SlideShare a Scribd company logo
1 of 14
From Zero to
Twitter Bootstrap & Zurb
Foundation on a Rails Backend

Stephen Cussen
for
RubyABQ
Dec 11th, 2013
the plan
•

‘from scratch’, without any previous experience,
build working rails app with bootstrap and
foundation front ends
what are the components?
•

Rails - well you all know what this is but the power
of rails was a real eye-opener for me!

•

Twitter Bootstrap …

•

Zurb Foundation …
where did I start?
•

the instruction from Michael (on the wiki):

•

1: install homebrew

•

2: install rvm

•

3: install rails

•

4: go for it!
so…
•

I installed Rails 4.0

•

new project named ‘artcards’

•

built my ‘artist’model - first name, last name,
description and small image name, large image name

•

migrated the database

•

ran the server - it worked! :-) (nothing much to show
yet)
branch
•

created a bootstrap branch from master in git

•

installed the bootstrap rails gem (show the Gemfile
on the branch - talk about less and libv8)

•

ran ‘rails g bootstrap:install’
adding images to the
database
•

moving back to the master - needed an image strategy. Chose paperclip

•

added the paperclip gem

•

ran ‘rails g paperclip artist <image_field_name>’ for a couple of image
fields

•

migrated the db

•

edited artist.rb (insert ‘has_attached_file’)

•

edited the _form.html.erb and the show.html.erb

•

And… I could select an image when I was using the form but no images in
the show artist :-(
easy to lose a few hours…
- added the paperclip gem (and installed imagemagick)
- rails generate paperclip artist small_image
- rails generate paperclip artist large_image
- rake db:migrate
- edit artis.rb
- edit _form.html.erb
- edit show.html.erb
- when adding the image - looks good - however, no image path is
stored
- Took a few hours and lots of reading to find out I needed to edit
‘artists_controllers.rb’ and add this
params.require(:artist).permit(:firstname, :lastname, :artiststatement,
:smallimagename, :largeimagename, :small_image, :large_image)
(I have a pull request in for the thouhtbot rdoc that I was working from
- paperclip README is good and covers this)
more images stuff
•

installed imagemagick on the base rails install with
paperclip and imagemagik

•

edited config/environments/development.rb to point to
imagemagik

•

edited index.html.erb to include thumb and change
heading

•

voila! (show the artists demo from master)
images to bootstrap
•

merged from master to the bootstrap branch so that
I could have all my good paperclip work and the
bootstrap work together (my first non-gui merge
prompted a call for help!)

•

on the bootstrap branch - set to work on making the
bootstrap layout ‘bootstrappy’
bootstrappy!
•

ran ‘rails g bootstrap:layout application fixed’ to
generate a bootstrap compatible layout (show
layouts)

•

voila (show the artists demo from the bootstrap
branch)
zurb foundation
•

created a ‘foundation’ branch

•

followed the super easy getting started with zurb foundation
docs (note: the rails install is under ‘Applications’)

•

using the the ‘foundation-rails’gem did the bundle and
install

•

made a couple of mods to add a grid layout and a navbar

•

and we have this (show the artists demo from the foundation
branch)
github.com/scussen

•

github.com/scussen/artcardbackend

•

‘master’ contains the base install with paperclip the art cards project and
artists application

•

the ‘boostrap’ branch contains the bootstrap gem and install, together with
the bootstrap-ized artists application

•

the ‘foundation’ branch contains the foundation gem and install, together
with the foundation-ized artists application
resources
•

getting started with rails - http://guides.rubyonrails.org/getting_started.html

•

the amazing Ryan Bates - Rails Cast #328

•

getting started with bootstrap - http://getbootstrap.com/getting-started/

•

The bootstrap rails gem doc - https://github.com/seyhunak/twitter-bootstrap-rails

•

rubyracer gem (V8 Javascript interpreter for ruby ) doc - https://github.com/cowboyd/therubyracer

•

Paperclip - early (2008) Ryan Bates - Rails Cast #134

•

paperclip doc - https://github.com/thoughtbot/paperclip

•

getting started with foundation - http://foundation.zurb.com/docs/

•

again, Ryan Bates - Rails Cast #417 - http://railscasts.com/episodes/417-foundation

•

and, what would I do without stackoverflow!

More Related Content

What's hot

End-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS servicesEnd-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS services
Massimo Ferre'
 

What's hot (10)

Capybara + RSpec - ruby dsl-based web ui qa automation
Capybara + RSpec - ruby dsl-based web ui qa automationCapybara + RSpec - ruby dsl-based web ui qa automation
Capybara + RSpec - ruby dsl-based web ui qa automation
 
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown!  Austin JUG June 24 2014Hadoop Demystified + Automation Smackdown!  Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
 
End-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS servicesEnd-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS services
 
Teaching a Designer to Use GitHub
Teaching a Designer to Use GitHubTeaching a Designer to Use GitHub
Teaching a Designer to Use GitHub
 
Hipster JS: Angular & Firebase (Tri-JS Meetup)
Hipster JS: Angular & Firebase (Tri-JS Meetup)Hipster JS: Angular & Firebase (Tri-JS Meetup)
Hipster JS: Angular & Firebase (Tri-JS Meetup)
 
Deploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker ToolsDeploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker Tools
 
Capybara
CapybaraCapybara
Capybara
 
DevOps best practices with OpenShift
DevOps best practices with OpenShiftDevOps best practices with OpenShift
DevOps best practices with OpenShift
 
Automating Aegir Platform builds with Git; Fabric; and Drush
Automating Aegir Platform builds with Git; Fabric; and DrushAutomating Aegir Platform builds with Git; Fabric; and Drush
Automating Aegir Platform builds with Git; Fabric; and Drush
 
Ruote: A Ruby workflow engine
Ruote:  A Ruby workflow engineRuote:  A Ruby workflow engine
Ruote: A Ruby workflow engine
 

Viewers also liked

Analyse three real adverts
Analyse three real advertsAnalyse three real adverts
Analyse three real adverts
NTKhanam
 
Analyse 3 digipaks
Analyse 3 digipaksAnalyse 3 digipaks
Analyse 3 digipaks
NTKhanam
 
Earthquake presentation
Earthquake presentationEarthquake presentation
Earthquake presentation
drobe113
 

Viewers also liked (14)

EXPO: racconta la tua identità
EXPO: racconta la tua identitàEXPO: racconta la tua identità
EXPO: racconta la tua identità
 
Pengembangan Unit Bisnis Distribusi
Pengembangan Unit Bisnis DistribusiPengembangan Unit Bisnis Distribusi
Pengembangan Unit Bisnis Distribusi
 
Analyse three real adverts
Analyse three real advertsAnalyse three real adverts
Analyse three real adverts
 
Unidad educativa particular
Unidad educativa particularUnidad educativa particular
Unidad educativa particular
 
Analyse 3 digipaks
Analyse 3 digipaksAnalyse 3 digipaks
Analyse 3 digipaks
 
Management trout on strategy
Management trout on strategyManagement trout on strategy
Management trout on strategy
 
Core audio
Core audioCore audio
Core audio
 
Innovative Training Tools
Innovative Training ToolsInnovative Training Tools
Innovative Training Tools
 
Nuovi strumenti formativi
Nuovi strumenti formativiNuovi strumenti formativi
Nuovi strumenti formativi
 
Para tikus, pasta gigi, dan problem solving
Para tikus, pasta gigi, dan problem solvingPara tikus, pasta gigi, dan problem solving
Para tikus, pasta gigi, dan problem solving
 
New Business Model: crearlo, analizzarlo, integrarlo, attuarlo
New Business Model: crearlo, analizzarlo, integrarlo, attuarloNew Business Model: crearlo, analizzarlo, integrarlo, attuarlo
New Business Model: crearlo, analizzarlo, integrarlo, attuarlo
 
Kebijakan penjualan & pembelian
Kebijakan penjualan & pembelianKebijakan penjualan & pembelian
Kebijakan penjualan & pembelian
 
Ultimate startup marketing guide
Ultimate startup marketing guideUltimate startup marketing guide
Ultimate startup marketing guide
 
Earthquake presentation
Earthquake presentationEarthquake presentation
Earthquake presentation
 

Similar to Beginning Rails Twitter Bootstrap and Zurb Foundation

Drupal Step-by-Step: How We Built Our Training Site, Part 2
Drupal Step-by-Step: How We Built Our Training Site, Part 2Drupal Step-by-Step: How We Built Our Training Site, Part 2
Drupal Step-by-Step: How We Built Our Training Site, Part 2
Acquia
 
SharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure FunctionsSharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure Functions
Sébastien Levert
 
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
Sébastien Levert
 
DockerCon SF 2015: Maintaining the official node.js docker image
DockerCon SF 2015: Maintaining the official node.js docker imageDockerCon SF 2015: Maintaining the official node.js docker image
DockerCon SF 2015: Maintaining the official node.js docker image
Docker, Inc.
 

Similar to Beginning Rails Twitter Bootstrap and Zurb Foundation (20)

Drupal Step-by-Step: How We Built Our Training Site, Part 2
Drupal Step-by-Step: How We Built Our Training Site, Part 2Drupal Step-by-Step: How We Built Our Training Site, Part 2
Drupal Step-by-Step: How We Built Our Training Site, Part 2
 
Rails 5 subjective overview
Rails 5 subjective overviewRails 5 subjective overview
Rails 5 subjective overview
 
SharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure FunctionsSharePoint Framework, Angular and Azure Functions
SharePoint Framework, Angular and Azure Functions
 
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
The Synergy of Drupal Hooks/APIs (Custom Module Development with ChartJS)
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.js
 
Vue 淺談前端建置工具
Vue 淺談前端建置工具Vue 淺談前端建置工具
Vue 淺談前端建置工具
 
Chaione Ember.js Training
Chaione Ember.js TrainingChaione Ember.js Training
Chaione Ember.js Training
 
Contributing to rails
Contributing to railsContributing to rails
Contributing to rails
 
Top 8 Ruby on Rails Gems
Top 8 Ruby on Rails GemsTop 8 Ruby on Rails Gems
Top 8 Ruby on Rails Gems
 
Treeshaking your CSS
Treeshaking your CSSTreeshaking your CSS
Treeshaking your CSS
 
DockerCon SF 2015: Maintaining the Official Node.js Docker Image
DockerCon SF 2015: Maintaining the Official Node.js Docker ImageDockerCon SF 2015: Maintaining the Official Node.js Docker Image
DockerCon SF 2015: Maintaining the Official Node.js Docker Image
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Development
 
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Lisbon 2017 - SharePoint Framework, Angular & Azure Funct...
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5
 
Supa fast Ruby + Rails
Supa fast Ruby + RailsSupa fast Ruby + Rails
Supa fast Ruby + Rails
 
Rails 3.1
Rails 3.1Rails 3.1
Rails 3.1
 
Introduction to Drupal 7 - Making a slideshow with Views 3
Introduction to Drupal 7 - Making a slideshow with Views 3Introduction to Drupal 7 - Making a slideshow with Views 3
Introduction to Drupal 7 - Making a slideshow with Views 3
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)
 
DockerCon SF 2015: Maintaining the official node.js docker image
DockerCon SF 2015: Maintaining the official node.js docker imageDockerCon SF 2015: Maintaining the official node.js docker image
DockerCon SF 2015: Maintaining the official node.js docker image
 

Recently uploaded

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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...
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Beginning Rails Twitter Bootstrap and Zurb Foundation

  • 1. From Zero to Twitter Bootstrap & Zurb Foundation on a Rails Backend Stephen Cussen for RubyABQ Dec 11th, 2013
  • 2. the plan • ‘from scratch’, without any previous experience, build working rails app with bootstrap and foundation front ends
  • 3. what are the components? • Rails - well you all know what this is but the power of rails was a real eye-opener for me! • Twitter Bootstrap … • Zurb Foundation …
  • 4. where did I start? • the instruction from Michael (on the wiki): • 1: install homebrew • 2: install rvm • 3: install rails • 4: go for it!
  • 5. so… • I installed Rails 4.0 • new project named ‘artcards’ • built my ‘artist’model - first name, last name, description and small image name, large image name • migrated the database • ran the server - it worked! :-) (nothing much to show yet)
  • 6. branch • created a bootstrap branch from master in git • installed the bootstrap rails gem (show the Gemfile on the branch - talk about less and libv8) • ran ‘rails g bootstrap:install’
  • 7. adding images to the database • moving back to the master - needed an image strategy. Chose paperclip • added the paperclip gem • ran ‘rails g paperclip artist <image_field_name>’ for a couple of image fields • migrated the db • edited artist.rb (insert ‘has_attached_file’) • edited the _form.html.erb and the show.html.erb • And… I could select an image when I was using the form but no images in the show artist :-(
  • 8. easy to lose a few hours… - added the paperclip gem (and installed imagemagick) - rails generate paperclip artist small_image - rails generate paperclip artist large_image - rake db:migrate - edit artis.rb - edit _form.html.erb - edit show.html.erb - when adding the image - looks good - however, no image path is stored - Took a few hours and lots of reading to find out I needed to edit ‘artists_controllers.rb’ and add this params.require(:artist).permit(:firstname, :lastname, :artiststatement, :smallimagename, :largeimagename, :small_image, :large_image) (I have a pull request in for the thouhtbot rdoc that I was working from - paperclip README is good and covers this)
  • 9. more images stuff • installed imagemagick on the base rails install with paperclip and imagemagik • edited config/environments/development.rb to point to imagemagik • edited index.html.erb to include thumb and change heading • voila! (show the artists demo from master)
  • 10. images to bootstrap • merged from master to the bootstrap branch so that I could have all my good paperclip work and the bootstrap work together (my first non-gui merge prompted a call for help!) • on the bootstrap branch - set to work on making the bootstrap layout ‘bootstrappy’
  • 11. bootstrappy! • ran ‘rails g bootstrap:layout application fixed’ to generate a bootstrap compatible layout (show layouts) • voila (show the artists demo from the bootstrap branch)
  • 12. zurb foundation • created a ‘foundation’ branch • followed the super easy getting started with zurb foundation docs (note: the rails install is under ‘Applications’) • using the the ‘foundation-rails’gem did the bundle and install • made a couple of mods to add a grid layout and a navbar • and we have this (show the artists demo from the foundation branch)
  • 13. github.com/scussen • github.com/scussen/artcardbackend • ‘master’ contains the base install with paperclip the art cards project and artists application • the ‘boostrap’ branch contains the bootstrap gem and install, together with the bootstrap-ized artists application • the ‘foundation’ branch contains the foundation gem and install, together with the foundation-ized artists application
  • 14. resources • getting started with rails - http://guides.rubyonrails.org/getting_started.html • the amazing Ryan Bates - Rails Cast #328 • getting started with bootstrap - http://getbootstrap.com/getting-started/ • The bootstrap rails gem doc - https://github.com/seyhunak/twitter-bootstrap-rails • rubyracer gem (V8 Javascript interpreter for ruby ) doc - https://github.com/cowboyd/therubyracer • Paperclip - early (2008) Ryan Bates - Rails Cast #134 • paperclip doc - https://github.com/thoughtbot/paperclip • getting started with foundation - http://foundation.zurb.com/docs/ • again, Ryan Bates - Rails Cast #417 - http://railscasts.com/episodes/417-foundation • and, what would I do without stackoverflow!

Editor's Notes

  1. start the presentation!