Skip to content

Instantly share code, notes, and snippets.

/Error Secret

Created September 17, 2012 10:32
Show Gist options
  • Save anonymous/53d88d8e2c83512cf163 to your computer and use it in GitHub Desktop.
Save anonymous/53d88d8e2c83512cf163 to your computer and use it in GitHub Desktop.
1.9.3p194 :003 > u = User.last
1.9.3p194 :003 > u.raw(u.male_list.sample(1), u.female_list.sample(1))
TypeError: can't convert String into Integer
def conditions(male, female)
girl = female
boy = male
boy_age = Time.now.year - boy["birthday_date"][boy["birthday_date"].size, boy["birthday_date"]-4]
girl_age = Time.now.year - girl["birthday_date"][girl["birthday_date"].size, girl["birthday_date"]-4]
if ((boy_age+7)/2) < girl_age
false
elsif boy["name"].include?(girl["last_name"])
false
# elsif boy[status] == 'relationship' || girl[status] == 'relationship'
# false
else
true
end
end
def raw(male, female)
female = female
male = male
if !conditions(male, female)
raw(current_user.male.sample(1), current_user.female.sample(1))
else
perfect_match = []
perfect_match << female
perfect_match << male
return perfect_match
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment