Skip to content

Instantly share code, notes, and snippets.

@tbbooher
Created January 25, 2009 18:35
Show Gist options
  • Select an option

  • Save tbbooher/52490 to your computer and use it in GitHub Desktop.

Select an option

Save tbbooher/52490 to your computer and use it in GitHub Desktop.
def user_has_not_explained_themself(params)
user_params = params[:user]
explanation_params = params[:explanation] || {}
names_of_titles_that_require_more_information = []
user_params.each do |p|
unless p[0] == "fitness_level"
if p[1] == "true" # do they have this condition?
# at this point, the condition will be added unless the member
# has typed in sufficient information into the field. So the field
# must exist _and_
if explanation_params.include?(p[0]) # they we have given them the form
if explanation_params[p[0]] == "please explain" # then, they didn't enter information
names_of_titles_that_require_more_information << p[0]
end
else # we need to add the field for the first time
names_of_titles_that_require_more_information << p[0]
end
end # true check
end
end
return names_of_titles_that_require_more_information
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment