Skip to content

Instantly share code, notes, and snippets.

@mackato
Created December 18, 2011 00:59
Show Gist options
  • Save mackato/1491998 to your computer and use it in GitHub Desktop.
Save mackato/1491998 to your computer and use it in GitHub Desktop.
Twitter Bootstrap for Rails Demo

Twitter Bootstrap Demo

% rails new demoapp
% cd demoapp
% rails g scaffold post title:string body:text published_at:datetime draft:boolean
% rake db:migrate

class Post < ActiveRecord::Base
	validates :title, :presence => true
	validates :body, :presence => true
end

% rails s
% open http://localhost:3000/posts

gem 'twitter-bootstrap-rails',
    :git => 'git://github.com/mackato/twitter-bootstrap-rails.git'
    
% bundle install
% rails g bootstrap:install
% rm -f app/assets/javascripts/posts.js.coffee\
  app/assets/stylesheets/bootstrap.css.less\
  app/assets/stylesheets/scaffolds.css.scss

% rails s
% open http://localhost:3000/posts

% rails g bootstrap:layout
% rails g bootstrap:layout application fluid
% open http://localhost:3000/posts

<li><%= link_to "Posts", posts_path %></li>
<li><%= link_to "New post", new_post_path %></li>

% rails g bootstrap:form post
% open http://localhost:3000/posts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment