Thursday, August 25th, 2005

Rails based Ajaxian Spell Checker

Category: Ruby

Dee Zsombor has written up How to build an AJAX-ed spellchecker with Ruby On Rails.

The tutorial walks you through binding to Aspell via Ajax, and takes you step by step (from starting a fresh Rails app).

Some of the Meat

<!-- file app/views/spell/_misspelled.rhtml -->
<%
  suggest_div = "suggest__#{cnt}"
  this_span = "id__#{cnt}"
%>
<span id='<%=this_span%>'>
<%=
  link_to_remote( 
    misspelled,
    { :complete => "showSuggestions('#{this_span}','#{suggest_div}')",
      :update => suggest_div,
      :condition =>"isInVisible('#{suggest_div}')",
      :url => {
        :action => 'suggest',
        :id => misspelled,
        :word_count => "#{cnt}"}},
      :class => 'misspelled',
      :title => 'Click for suggested spellings') -%>
</span>
<ul style="display:none" class="suggestions" id='<%=suggest_div%>'></ul>

Check out a live demo of the application

Ajax/Ruby Spellcheck

Posted by Dion Almaer at 9:45 am
1 Comment

+++--
3.3 rating from 7 votes

1 Comment »

Comments feed

For real time spell checker see http://me.eae.net/archive/2005/07/26/litespellchecker/

Comment by Erik Arvidsson — August 28, 2005

Leave a comment

You must be logged in to post a comment.