profile spec passes
This commit is contained in:
parent
8818a9bb6f
commit
8d86585928
1 changed files with 21 additions and 3 deletions
|
|
@ -56,17 +56,29 @@ class Profile < ActiveRecord::Base
|
|||
|
||||
def image_url= url
|
||||
return image_url if url == ''
|
||||
super(url)
|
||||
if url.nil? || url.match(/^https?:\/\//)
|
||||
super(url)
|
||||
else
|
||||
super(absolutify_local_url(url))
|
||||
end
|
||||
end
|
||||
|
||||
def image_url_small= url
|
||||
return image_url if url == ''
|
||||
super(url)
|
||||
if url.nil? || url.match(/^https?:\/\//)
|
||||
super(url)
|
||||
else
|
||||
super(absolutify_local_url(url))
|
||||
end
|
||||
end
|
||||
|
||||
def image_url_medium= url
|
||||
return image_url if url == ''
|
||||
super(url)
|
||||
if url.nil? || url.match(/^https?:\/\//)
|
||||
super(url)
|
||||
else
|
||||
super(absolutify_local_url(url))
|
||||
end
|
||||
end
|
||||
|
||||
def date= params
|
||||
|
|
@ -86,4 +98,10 @@ class Profile < ActiveRecord::Base
|
|||
self.last_name.strip! if self.last_name
|
||||
end
|
||||
|
||||
private
|
||||
def absolutify_local_url url
|
||||
pod_url = AppConfig[:pod_url].dup
|
||||
pod_url.chop! if AppConfig[:pod_url][-1,1] == '/'
|
||||
"#{pod_url}#{url}"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue