I have 2 models: Business and Program.
class Business < ActiveRecord::Base
has_many :programs
class Program < ActiveRecord::Base
belongs_to :business
Businesses have many programs. Both businesses and programs have latitude and longitude columns in their respective tables. Sometimes program is the same address as business, but not always. Right now I only store address for Program in programs table if it is different from business's address, meaning latitude / longitude columns are blank if it is the same. If I do keep address blank for a program instance (latitude & longitude are blank), I would like to use Geocoder .near method call to search also include the address of Business from business table.
In other words, if I do this now:
@programs = Program.near(params....)
I only get programs that have latitude / longitude recorded in the Programs table. Obviously this is expected. Is there any way to change either the near method (without forking the gem) or use scopes to have the call above also check Businesses table if latitude / longitude is blank for a Program instance?