added an index to root_id
This commit is contained in:
parent
621075d4e1
commit
27dcdf9a11
4 changed files with 16 additions and 2 deletions
|
|
@ -46,6 +46,10 @@ class Post < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def reshare_count
|
||||
@reshare_count ||= Post.where(:root_guid => self.guid).count
|
||||
end
|
||||
|
||||
def diaspora_handle= nd
|
||||
self.author = Person.where(:diaspora_handle => nd).first
|
||||
write_attribute(:diaspora_handle, nd)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
%span.timeago
|
||||
= link_to(how_long_ago(post), post_path(post))
|
||||
–
|
||||
= t("reshares.reshare.reshare", :count => post.reshares.size)
|
||||
= t("reshares.reshare.reshare", :count => post.reshare_count)
|
||||
|
||||
- if post.activity_streams?
|
||||
= link_to image_tag(post.image_url, 'data-small-photo' => post.image_url, 'data-full-photo' => post.image_url, :class => 'stream-photo'), post.object_url, :class => "stream-photo-link"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
class AddRootGuidIndexToPosts < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :posts, :root_guid
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :posts, :column => :root_guid
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20110926120220) do
|
||||
ActiveRecord::Schema.define(:version => 20110930182048) do
|
||||
|
||||
create_table "aspect_memberships", :force => true do |t|
|
||||
t.integer "aspect_id", :null => false
|
||||
|
|
@ -287,6 +287,7 @@ ActiveRecord::Schema.define(:version => 20110926120220) do
|
|||
|
||||
add_index "posts", ["author_id"], :name => "index_posts_on_person_id"
|
||||
add_index "posts", ["guid"], :name => "index_posts_on_guid", :unique => true
|
||||
add_index "posts", ["root_guid"], :name => "index_posts_on_root_guid"
|
||||
add_index "posts", ["status_message_guid", "pending"], :name => "index_posts_on_status_message_guid_and_pending"
|
||||
add_index "posts", ["status_message_guid"], :name => "index_posts_on_status_message_guid"
|
||||
add_index "posts", ["type", "pending", "id"], :name => "index_posts_on_type_and_pending_and_id"
|
||||
|
|
|
|||
Loading…
Reference in a new issue