Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Created November 23, 2009 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrchrisadams/240812 to your computer and use it in GitHub Desktop.
Save mrchrisadams/240812 to your computer and use it in GitHub Desktop.
# this is ridonkulously ugly, and looks like an ideal candidate for a case statement, but my understanding was that case statements can only be used to for a single variable, not two.
# any alternatives greatly appreciated
def just_one_kind_of_response?(item, controller)
if (controller == 'actions' && detail.comments.blank?) || (controller == 'actions' && item.comments.blank?) || (controller == 'actions' && item.suggestions.blank?) || (controller == 'thoughts' && item.comments.blank?) || (controller == 'thoughts' && item.suggestions.blank?) || (controller == 'suggestions' && item.comments.blank?) || (controller == 'suggestions' && item.actions.blank?)
return true
else
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment