Posted by Chris Blackburn Wed, 25 Jun 2008 17:41:00 GMT

I’ll be publishing the status_update plugin for Rails in the coming weeks. The plugin is an interface to Ping.fm, the cool new service that allows you to update all of your social network statuses with a single API.

Coming Soon…

Posted by Chris Blackburn Thu, 19 Jun 2008 01:01:00 GMT

schema.rb for states table
create_table "states", :force => true do |t|
  t.string   "name"
  t.string   "abbreviation", :limit => 2
  t.datetime "created_at"
  t.datetime "updated_at"
end
cities_controller.rb
# GET /cities/new
# GET /cities/new.xml
def new
  @city = City.new
  @states = State.find(:all, :order => :abbreviation)

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @city }
  end
end
new.html.erb view for cities_controller.rb
<% form_for(@city) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :state_id %><br />
    <%= f.collection_select(:state_id, @states, "id", "abbreviation") %>
  </p>
  <p>
    <%= f.submit "Create" %>
  </p>
<% end %>

Older posts: 1 2