Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

state as select list for a story

  • Loading branch information...
commit 21318f4e491f9d8edcb24ad7e7b81c588ab12dae 1 parent c2342b2
Laura authored
2  app/controllers/board_controller.rb
View
@@ -1,6 +1,6 @@
class BoardController < ApplicationController
def show
- @backlog = Story.find :all, :conditions => 'state IS NULL'
+ @backlog = Story.find :all, :conditions => 'state = "B"'
@priority = Story.find :all, :conditions => 'state = "P"'
@active = Story.find :all, :conditions => 'state = "A"'
@delegated = Story.find :all, :conditions => 'state = "D"'
1  app/views/stories/_form.html.erb
View
@@ -16,6 +16,7 @@
<%= f.text_field :task %>
</div>
<div class="field">
+ <%= select(:story, :state, [['Backlog', 'B'], ['Priority', 'P'], ['Active', 'A'], ['Delegated', 'D'], ['Done', 'C']]) %>
</div>
<div class="field">
<%= f.label :notes %><br />
10 db/migrate/20110402201330_change_table_story_add_state_default.rb
View
@@ -0,0 +1,10 @@
+class ChangeTableStoryAddStateDefault < ActiveRecord::Migration
+ def self.up
+ Story.update_all( "state = 'B'", "state IS NULL" )
+ Story.update_all( "state = 'B'", "state = ''" )
+ end
+
+ def self.down
+ Story.update_all( "state = NULL", "state = 'B'" )
+ end
+end
4 db/schema.rb
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110313064001) do
+ActiveRecord::Schema.define(:version => 20110402201330) do
create_table "stories", :force => true do |t|
t.string "task"
@@ -20,7 +20,7 @@
t.integer "column_ord"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "state"
+ t.string "state", :default => "B"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.