Permalink
Browse files

Remove the discussions_count cache column on User

  • Loading branch information...
1 parent 45c6d03 commit be16dc6d13a845bbcc8d8df54347f819efae5f43 @elektronaut committed Mar 21, 2013
View
@@ -26,7 +26,7 @@ class Exchange < ActiveRecord::Base
# User which is updating the exchange, required for closing exchanges
attr_accessor :updated_by
- belongs_to :poster, :class_name => 'User', :counter_cache => :discussions_count
+ belongs_to :poster, :class_name => 'User'
belongs_to :closer, :class_name => 'User'
belongs_to :last_poster, :class_name => 'User'
has_many :posts, :order => ['created_at ASC'], :dependent => :destroy, :foreign_key => 'discussion_id'
View
@@ -111,7 +111,7 @@ def serializable_params
[
:id, :username, :realname, :latitude, :longitude, :inviter_id,
:last_active, :created_at, :description, :admin,
- :moderator, :user_admin, :posts_count, :discussions_count,
+ :moderator, :user_admin,
:location, :gamertag, :avatar_url, :twitter, :flickr, :instagram, :website,
:msn, :gtalk, :last_fm, :facebok_uid, :banned_until
]
@@ -0,0 +1,5 @@
+class RemoveUserDiscussionsCount < ActiveRecord::Migration
+ def change
+ remove_column :users, :discussions_count
+ end
+end
View
@@ -14,9 +14,9 @@
let(:user_admin) { create(:user_admin) }
let(:public_attributes) { [
"admin", "avatar_url", "banned_until", "created_at", "description",
- "discussions_count", "flickr", "gamertag", "gtalk", "id", "instagram",
+ "flickr", "gamertag", "gtalk", "id", "instagram",
"inviter_id", "last_active", "last_fm", "latitude", "location", "longitude",
- "moderator", "msn", "posts_count", "realname", "twitter", "user_admin",
+ "moderator", "msn", "realname", "twitter", "user_admin",
"username", "website", "active", "banned"
] }

0 comments on commit be16dc6

Please sign in to comment.