Lazily initialize Contact proxy in service helper
This prevents connecting to the database on rake assets:precompile, which fails in certain build environments. Running git blame on this and figuring out what in gods name this is for, is for another time.
This commit is contained in:
parent
3fcd0c683c
commit
ec2a209b68
1 changed files with 7 additions and 2 deletions
|
|
@ -1,6 +1,11 @@
|
|||
module ServicesHelper
|
||||
@@contact_proxy = Contact.new(:aspects => [])
|
||||
def contact_proxy(friend)
|
||||
friend.contact || @@contact_proxy.dup.tap{|c| c.person = friend.person}
|
||||
friend.contact || contact_proxy_template.dup.tap {|c| c.person = friend.person }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def contact_proxy_template
|
||||
@@contact_proxy ||= Contact.new(:aspects => [])
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue