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…
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"
endcities_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
endnew.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
