Skip to content

Commit

Permalink
fix populator will not auto count post numbers
Browse files Browse the repository at this point in the history
now I set the number myself
  • Loading branch information
othree committed Jan 21, 2011
1 parent 9e3378c commit 9a951ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/migrate/20110113040434_add_post_count.rb
@@ -1,6 +1,6 @@
class AddPostCount < ActiveRecord::Migration
def self.up
add_column :forums, :posts_count, :integer, :default => 0
add_column :forums, :posts_count, :integer, :default => 0, :null => false
Forum.reset_column_information
Forum.find(:all).each do |f|
Forum.update_counters f.id, :posts_count => f.posts.length
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb
Expand Up @@ -17,7 +17,7 @@
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "posts_count", :default => 0
t.integer "posts_count", :default => 0, :null => false
end

create_table "posts", :force => true do |t|
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/dev.rake
Expand Up @@ -20,6 +20,8 @@ namespace :dev do
post.content = 'Article Content'
post.forum_id = forum.id
end

forum.posts_count = 50
end

end
Expand Down

0 comments on commit 9a951ac

Please sign in to comment.