Merge branch 'master' of github.com:diaspora/diaspora_rails
This commit is contained in:
commit
b63b7fe482
1 changed files with 8 additions and 1 deletions
|
|
@ -8,10 +8,17 @@ class Author
|
|||
key :profile_url, String
|
||||
|
||||
many :ostatus_posts, :class_name => 'OstatusPost', :foreign_key => :author_id
|
||||
|
||||
before_save :set_defaults
|
||||
|
||||
def self.instantiate(opts)
|
||||
author = Author.first(:feed_url => opts[:feed_url])
|
||||
author ||= Author.create(opts)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_defaults
|
||||
self.avatar_thumbnail = nil if self.avatar_thumbnail == 0
|
||||
self.service = self.url if self.service == 0
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue