i have a model with a model called site.rb
i have a method in it that will check to see if any of the options for
this site has a pressure sensor.
def has_pressure_sensor?
self.site_options.any? {|option| option.option == 'pressure'}
end
now, site belongs_to :group.
i keep screwing up when i try to write a function that checks to see
if any of the sites that belong to a group has the sensor.
i tried like this
@group.sites.each do |site|
site.has_pressure_sensor?
i was thinking that if any of the sites returned true, that i would
have the true/false there. But it isn't working right.
ok, i put it in and it didn't fail out, but it is evaluating true every
time. Even if i select a site that does not have one. Is there
something i am missing ?
sk