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

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 

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!