full_contact action only returns FullContact details if the gem is installed
This commit is contained in:
parent
64ebf2f26b
commit
238eba4a50
1 changed files with 8 additions and 4 deletions
|
@ -58,12 +58,16 @@ module Nonprofits
|
||||||
end
|
end
|
||||||
|
|
||||||
def full_contact
|
def full_contact
|
||||||
fc = FullContactInfo.where("supporter_id=#{params[:id]}").first
|
begin
|
||||||
if fc
|
s = Supporter.find params[:id]
|
||||||
|
if s.method_defined? :full_contact_infos && (fc = s.full_contact_infos.first)
|
||||||
render json: { full_contact: QueryFullContactInfos.fetch_associated_tables(fc.id) }
|
render json: { full_contact: QueryFullContactInfos.fetch_associated_tables(fc.id) }
|
||||||
else
|
else
|
||||||
render json: { full_contact: nil }
|
render json: { full_contact: nil }
|
||||||
end
|
end
|
||||||
|
rescue
|
||||||
|
render json: { full_contact: nil }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def info_card
|
def info_card
|
||||||
|
|
Loading…
Reference in a new issue