Skip to content

Instantly share code, notes, and snippets.

@deepak
Created November 22, 2010 08:14
Show Gist options
  • Save deepak/709663 to your computer and use it in GitHub Desktop.
Save deepak/709663 to your computer and use it in GitHub Desktop.
went on a refactoring/beautification overdrive just so that the lines are under 80 columns
# went on a refactoring/beautification overdrive just so that the lines are under 80 columns
# ruby statements that overflow into the next row are an abomination :-)
# mangled production-code to remove const-names. It is not production or even code which has been run before
# please refactor!!
# * Any better way to make sure the long condition string is properly formatted
# * the gsub(/\s/, '') is also suspect as it would replace spaces etc in a proper sql
Comment.count(:id,
:include => [:person, :had_commented],
:conditions => [<<-SQL.gsub(/\s/, '')
status in (?)
and #{Person.table_name}.status = ?
and #{HadCommented.table_name}.created_at >= current() - 10
SQL
].insert(-1,
BlogStatus::STATUS_NAMES.values_at(:pending, :flag),
'registered'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment