Skip to content

Instantly share code, notes, and snippets.

@davidjrice
Forked from tommyp/gist:882407
Created March 23, 2011 00:56
Show Gist options
  • Save davidjrice/882431 to your computer and use it in GitHub Desktop.
Save davidjrice/882431 to your computer and use it in GitHub Desktop.
class ControlWord
def positive?
self.class.positive?( title )
end
def promote!
update_attribute(:pos, pos+1)
end
end
@words = entry.title.scan(/\w+/)
@words.each do |word|
control_word = ControlWord.exists?( word )
if control_word
control_word.promote!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment