Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

102 lines (53 sloc) 3.077 kB

Bootstrapped

A gem containing Twitter's Bootstrap CSS Project, a JQuery Plugin to simply user interface interactivity, and generators to make scaffolds sexy.

In addition, it as generators based off of Ryan Bates nifty-generators github.com/ryanb/nifty-generators/. enables you to create fully styled user interfaces using Bootstrap CSS with very little effort. There is one difference though, HAML generators are not included.

Setup

Rails 3

Add the gem to your Gemfile.

gem "bootstrapped"

Add the following to the application.css in the Rails 3.1 pipeline pipeline

*= require bootstrap

Include any of the BootStrap JavaScript files as necessary

//= require bootstrap-alert
//= require bootstrap-dropdown

//= require bootstrap-modal //= require bootstrap-popover //= require bootstrap-scrollspy //= require bootstrap-tabs //= require bootstrap-twipsy

//= require jquery.tablesorter

The Table Sorter JQuery plugin is only required if you want tables that allow you to order on the column headings.

Then you can run any of the included generators.

rails g bootstrapped:scaffold Recipe name:string index new

Included Generators

  • bootstrapped:layout: generates generic layout, stylesheet, and helper files.

  • bootstrapped:scaffold: generates a controller and optional model/migration.

To view the README for each generator, run it with the help option.

rails g bootstrapped:layout --help

Troubleshooting and FAQs

What is the difference between bootstrapped:scaffold and built-in scaffold?

One of the primary differences is that bootstrapped:scaffold allows you to choose which controller actions to generate.

rails g bootstrapped:scaffold post name:string index new edit

There are a few changes to the generated code as well, such as no XML format by default.

It also offers support for Shoulda, and RSpec.

I get “undefined method 'title'” error.

Try running bootstrapped:layout, that will generate this helper method. Or you can just change the templates to whatever approach you prefer for setting the title.

I can't set new attributes in my model.

Add the attribute to the attr_accessible line in the model.

I get “undefined method 'root_url'” error.

Some generators default redirecting to the root_url. Set this in your routes.rb file like this (substituting your controller name).

root :to => "home#index"

I get a missing database error.

Run rake db:migrate.

I get a routing error when I try to submit a form.

Try restarting your development server. Sometimes it doesn't detect the change in the routing.

The tests/specs don't work.

Make sure you have mocha installed and require it in your spec/test helper.

gem install mocha

# in spec_helper.rb
config.mock_with :mocha

# in test_helper.rb
require 'mocha'

Found a bug?

If you are having a problem with Bootstrapped, first look at the FAQs above. If you still cannot resolve it, please submit an issue here.

github.com/entropillc/bootstrapped/issues

Jump to Line
Something went wrong with that request. Please try again.