After an awesome mountainbike ride I’ve managed to break my collar bone. I wouldn’t recommend this 
So I though I’d make the most of the ‘opportunity’ and have a look at RoR..
Goal: To deploy an application live
Downloading RoR
rubyonrail.org – download. Getting 1.8.7 of Ruby.. tick add to executable, and associate .rb
rubygems – package manager..extract, run setup.rb
gem install rails 2.3.5
rails --version
http://docs.heroku.com/windows – good install screencast
Hello World App
rails blog
cd blog
ruby script/server
localhost:3000
uses WEBrick 1.3.1
am getting strange error:

Install SQLite3
http://akitaonrails.com/2009/01/13/the-best-environment-for-rails-on-windows
http://www.sqlite.org/download.html
sqlite3.exe into \windows
sqlite3.dll into system32
http://allaboutruby.wordpress.com/2009/07/20/installing-rails-on-windows-3-years-later/
gem install sqlite3-ruby
cd \code\ruby\hello
ruby script\server
the crowd goes wild!!!
ruby script/generate scaffold post title:string description:text
This command creates a Post scaffold, a model/controller/view ready to be updated. The post model will have 2 fields – a title which is a single line of text and a description, which is multi-line text.
Run the database migration. This is because after creating the scaffold, the database is not automatically updated with the new blog model, you need to do it manually by running a rake db:migrate command
cool – now have db integration and working scaffold
http://railsforum.com/
http://railscasts.com/episodes/archive
http://allaboutruby.wordpress.com/2009/08/08/5-minute-project-in-rails/ – very simple app.
http://ruby-toolbox.com/categories/rails_form_builders.html
http://guides.rubyonrails.org/getting_started.html#installing-rails
in c:\code
rails blog - this creates a rails app that uses sqllite.
The Blog from Guide
http://guides.rubyonrails.org/getting_started.html
rails blog
rake db:create
rake –T shows all rake (general purpose command runner) commands
ruby script/generate controller home index -creates files including app/views/home/index.html.erb. This is the template that will be used to display the results of the:
index action (method) in the home controller.
edit index.html.erb to <H1>Hello Rails</H1>
ruby script\server
http://locahost:3000/home/index
Change home page
config\routes.rb
map.root :controller => "home"
Scaffolding
Rails scaffolding is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.
ruby script/generate scaffold Post name:string title:string content:text
This creates a model, a db migration ruby file, views and changes the config\route.rb file.
rake db:migrate
put in: <%= link_to "My Blog", posts_path %>
then
Validation
The model file, app/models/post.rb is about as simple as it can get:
validates_presence_of :name, :title
validates_length_of :title, :minimum => 5
View
<% @posts.each do |post| %>
<tr>
<td><%=h post.name %></td>
<td><%=h post.title %></td>
<td><%=h post.content %></td>
<td><%= link_to 'Show', post %></td>
<td><%= link_to 'Edit', edit_post_path(post) %></td>
<td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
h is a rails helper
lik_to buils hyperlinks
edit_post_path
new_post_path
Layout
These are containers for views
app\views\layouts\posts.html.erb
<body style="background: #EEEEEE;">
now all views for posts have a grey background
Entering Data and Wiring Up
<% form_for(@post) do |f| %>
<%= f.error_messages %>
form_for block is used to create an html form..
<%= f.label :name %><br />
<%= f.text_field :name %>
wires up a text box with name attribute
DRYing up Code - Partials
scaffold generated views for new and edit are largely identical.. so can use partials template.
_form.html.erb underscore is convention for partial
<% form_for(@post) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :title %><br />
<%= f.text_field :title %>
</p>
<p>
<%= f.label :content %><br />
<%= f.text_area :content %>
</p>
<p>
<%= f.submit 'Save' %>
</p>
<% end %>
and in new.html.erb
<h1>New post</h1>
<%= render :partial => "form" %>
<%= link_to 'Back', posts_path %>
****7.2 Using Filters to eliminate controller duplication
http://wiki.devchix.com/index.php?title=Server_2003
The Blog App Video
From front page of rails site:
http://www.opensourcerails.com/
http://www.softwaredeveloper.com/features/best-ruby-on-rails-061307/
http://www.3months.com/technology
http://blog.obiefernandez.com/content/
Auth
http://wiki.rubyonrails.org/howtos/authentication-authorization
Authentication is what you do when you let a user identify itself. This is needed when you want to offer a login access to your application.
Authorization is what you do when you check the credentials of a user before letting him/her interact with specific sections of your system. This is needed when you have restricted areas/actions.