Sunday, October 16, 2011

My Note from "The Intro to Rails Screencast I Wish I Had"

I found that The Intro to Rails Screencast I Wish I Had is very good in demostrating some tricks that make Rails different to other web development frameworks.

Below are notes from my 2nd time watching this screencast. What I note are things that I've never known before or I can't really remember the way to use it.

  • Add -T in rails new to prevent rails from generating Test::Unit
  • Gems
    • turn (Pretty printing for test results)
    • guard-rspec (Autotest)
    • growl_notify
    • rb-fsevent
    • launchy
      • save_and_open_page (use along with Capybara statements)
  • Guard
    • guard init rspec
    • guard (start guard)
  • RSpec integration test
    • rails g integration_test {name}
  • Routes
    • rake routes
    • resources (auto routes)
  • Capybara (route_name comes from first column of rake route)
    • visit {route_name}_path
    • page.should have_content {string}
    • fill_in {id/name/label}, :with => {string}
    • click_button {id/name/label}
    • current_path.should == {route_name}_path
    • find_field('').value
  • ActiveModel
    • {Model}.create {value}
    • {model_instance}.update_attributes {fields hash}
  • ERB
    • form_for {object} do | f |
    • f.label :{name}
    • f.text_field :{name}
    • f.submit
    • render '{partial view(No _)}'  <- partial view file name must prefix with _ 
    • flash.each do | name, message | (come from params passed with redirect_to)
  • Controller
    • render :text => params.inspect
    • redirect_to :back (previous page)
    • (redirect_to) {:notice | :alert} => {string} (will be available in flash)

No comments:

[PostgreSQL] How to create read-only standby replica (follower)

This link  and this link explain it really well and concise