Scaffolding and twitter bootstrap


RialsにBootstrapを簡単にScaffoldingする

~/Documents/ruby $ rails new article_app

$ cd article app/
~/Documents/ruby/article_app $ nano Gemfile
**write below on the above of the gem file

//gemで以下の機能を追加してあげる
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"

//gemでboundleとbootstrapをインストール
$ boudle install

$ rails g bootstrap:install
//check ~/Documents/ruby/article_app/app/views/layouts/application.html.erb

$ rails g bootstrap:layout application fixed ->yes
//then check ~/Documents/ruby/article_app/app/views/layouts/application.html.erb ...changed!

$rails g scaffold articles title:string body:text
//after above check /config/routes.rb ... is already configured.

//add below on same file.
//4行目あたりに root :to => "articles#index" を追記

//after above we can check that the needed files like models and controllers was added.

~/Documents/ruby/article_app $ rails s

~/Documents/ruby/article_app $ rake db:migrate

~/Documents/ruby/article_app $ rails s

rails bootstrap:themed articles -f

//then go to ~/Documents/ruby/article_app/app/views/articles/_form.html.erb
//change line11: ...<%= f.text_field to <%=f.text_area 

Resource