Merge pull request #1826 from nporteschaikin/patch-1

Delegate :username rather than using a class method.
This commit is contained in:
Robin Ward 2014-01-17 13:54:11 -08:00
commit 3bbe595d10

View file

@ -52,6 +52,8 @@ class Post < ActiveRecord::Base
scope :private_posts, -> { joins(:topic).where('topics.archetype = ?', Archetype.private_message) }
scope :with_topic_subtype, ->(subtype) { joins(:topic).where('topics.subtype = ?', subtype) }
delegate :username, to: :user
def self.hidden_reasons
@hidden_reasons ||= Enum.new(:flag_threshold_reached, :flag_threshold_reached_again, :new_user_spam_threshold_reached)
end
@ -215,10 +217,6 @@ class Post < ActiveRecord::Base
cooked
end
def username
user.username
end
def external_id
"#{topic_id}/#{post_number}"
end