MS minor defaults change
This commit is contained in:
parent
0ae5ed8bdb
commit
00159d1fb8
1 changed files with 8 additions and 1 deletions
|
|
@ -8,10 +8,17 @@ class Author
|
||||||
key :profile_url, String
|
key :profile_url, String
|
||||||
|
|
||||||
many :ostatus_posts, :class_name => 'OstatusPost', :foreign_key => :author_id
|
many :ostatus_posts, :class_name => 'OstatusPost', :foreign_key => :author_id
|
||||||
|
before_save :set_defaults
|
||||||
|
|
||||||
def self.instantiate(opts)
|
def self.instantiate(opts)
|
||||||
author = Author.first(:feed_url => opts[:feed_url])
|
author = Author.first(:feed_url => opts[:feed_url])
|
||||||
author ||= Author.create(opts)
|
author ||= Author.create(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_defaults
|
||||||
|
self.avatar_thumbnail = nil if self.avatar_thumbnail == 0
|
||||||
|
self.service = self.url if self.service == 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue