[refs #194] add creator to issue

This commit is contained in:
Alexander Machehin 2012-02-19 23:27:47 +06:00
parent 55379ed9c8
commit 76beb6a277
3 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@ class Issue < ActiveRecord::Base
belongs_to :project
belongs_to :user
belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
has_many :comments, :as => :commentable, :dependent => :destroy #, :finder_sql => proc { "comments.commentable_id = '#{self.id}' AND comments.commentable_type = '#{self.class.name}'"}
has_many :subscribes, :as => :subscribeable, :dependent => :destroy #, :finder_sql => proc { "subscribes.subscribeable_id = '#{self.id}' AND subscribes.subscribeable_type = '#{self.class.name}'"}

View File

@ -96,6 +96,10 @@ class User < ActiveRecord::Base
email.downcase == commit.committer.email.downcase
end
def avatar(size)
"https://secure.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}?s=#{size}&r=pg"
end
private
def create_settings_notifier

View File

@ -0,0 +1,5 @@
class AddCreatorToIssue < ActiveRecord::Migration
def change
add_column :issues, :creator_id, :integer
end
end