Unfortunately whistler's answer might not be suitable in many cases. For instance, it doesn't work both ways. For instance, suppose you create a new word:
word = Word.create(:word_name => 'tremble')
['shake', 'vibrate'].each { |syn| word.synonyms.create(:word_name => syn) }
Now, if you do:
word = Word.find_by_word_name('tremble')
p word.synonyms # this would print out the Words with the word_name 'shake' and 'vibrate'.
however,
if you did it the other way around:
word = Word.find_by_word_name('vibrate')
p word.synonyms # this would print an empty association.
This is saying the word 'vibrate' has NO synonyms.
So basically, this method won't work both ways (i.e. vibrate is a synonym of tremble, and tremble is a synonym for vibrate)
Edit: In a sense, you could use this approach, however, you would have to explicitly assign the synonyms for each word. So although you specified synonyms of tremble (which are 'vibrate' and 'shake'), you would have to still specify synonyms of 'shake' ('which are 'tremble' and 'vibrate') and 'vibrate' (which are 'tremble' and shake') as well.