This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Mon Aug 04 00:09:52 -0700 2008 | |
| |
README | Fri Sep 05 00:43:04 -0700 2008 | |
| |
Rakefile | Sun Jul 06 04:43:29 -0700 2008 | |
| |
init.rb | Sun Aug 03 23:45:28 -0700 2008 | |
| |
lib/ | Fri Sep 05 00:29:47 -0700 2008 | |
| |
tasks/ | Mon Aug 04 00:09:52 -0700 2008 | |
| |
test/ | Sun Jul 06 04:43:29 -0700 2008 |
README
ActsAsDictionary ================ ActsAsDictionary creates Hunspell (http://hunspell.sourceforge.net/) dictionaries using data from ActiveRecord models and provides class methods to access these dictionaries. Pre-requisites ============== This plugin requires the Hunspell library and RubyInline gem. To install Hunspell: curl -O http://nchc.dl.sourceforge.net/sourceforge/hunspell/hunspell-1.2.7.tar.gz tar -zxvf hunspell-1.2.7.tar.gz cd hunspell-1.2.7 ./configure make sudo make install To install RubyInline: gem install RubyInline Setup ===== Within a model, define the column you want to work with: class Klass < ActiveRecord::Base acts_as_dictionary :checks => :name end Or, if you want to create dictionaries using two or more columns class Klass < ActiveRecord::Base acts_as_dictionary :checks => [:name, :type] end Once done, you can proceed to generate basic Hunspell dictionary files with: rake dict:generate In the above example, the following files will be generated: #{Rails.root}/dict/klass_names.aff #{Rails.root}/dict/klass_names.dic #{Rails.root}/dict/klass_types.aff #{Rails.root}/dict/klass_types.dic Each pair of these files (*.aff and *.dic) are Hunspell dictionary definition files which you can further configure if needed (see http://sourceforge.net/docman/display_doc.php?docid=29374&group_id=143754). Note that if manually configure the files, running the dict:generate Rake task again will override your manual configurations. Usage ===== With this plugin, the following dynamic class methods are available (replace * with a column name you have specified to check): >> Klass.find_by_*_with_spell_check("Naem") => #<Klass id: 1, name: "Name"> >> Klass.suggest_*("Naem") => ["Name", "Name2"] >> Klass.check_*("Name") => true







