Skip to content

Instantly share code, notes, and snippets.

@DemitryT
Created June 4, 2012 20:03
Show Gist options
  • Save DemitryT/2870537 to your computer and use it in GitHub Desktop.
Save DemitryT/2870537 to your computer and use it in GitHub Desktop.
users_controller.rb
if current_company.has_rentals?
property_ids = []
@lead.rental_saved_searches.each do |rss|
if rss.rental_search.send(current_company.rental_property_type) == true
@lead_details[:saved_searches][:rentals] << rss
end
end
if current_company.rentals_lead_plan.to_sym == :one
@lead.favorite_rental_properties.each do |frp|
if frp.rental_property_type == current_company.rental_property_type
property_ids << frp.rental_property_id
@lead_details[:favorite_properties][:rentals] << frp
end
end
@lead.rental_property_notes.each do |rpn|
if rpn.rental_property_type == current_company.rental_property_type
property_ids << rpn.rental_property_id
@lead_details[:property_notes][:rentals][rpn.rental_property_id] ||= []
@lead_details[:property_notes][:rentals][rpn.rental_property_id] << rpn
end
end
end
rental_ids = property_ids.flatten.uniq
@rental_properties = {}
unless rental_ids.blank?
rental_properties = get_rental_properties(rental_ids.join(','), current_company)
rental_properties.each do |prop|
@rental_properties[prop.id.to_s] = prop
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment