Actually, I'll try for the instance method for the male version in
name.rb..
def find_similar_male
# get all users
users = User.all
# get all male names
names = Name.male
# get the similar names
similar_names = []
# loop users...
users.each do |user|
# loop names
user.names.male.each do |name|
if self.given == name.given
# match add all the names from this list into the net
similar_names << name.given
# or perhaps put the whole object in like similar_names << name
else
# no match, do nada
end
# go to next name in users list
end
# go to next user in users list
end
end
Am I on the right lines at least?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.