Rails 3 Autocomplete - Suggesting Alternatives? - ruby-on-rails

I'm current using Rails 3 autocomplete in an application, but I'd like to know if there is any way to allow the app to make suggestions based on misspelled words.
For example, 'Saving Pirvaet Ryan' would still suggest 'Saving Private Ryan'.
Any suggestions?

It seems to me that what you are looking for is a fulltext search. While I personally haven't touched it yet, you might want to check out Sphinx/Thinking Sphinx, or Solr/Sunspot
EDIT Ok, I read too fast, this doesn't seem to fit what you're asking. Still leaving this here in case it can help anyone.

Related

Rails full text search PgSql

I am working in rails 3.2 and using pgsql, Thing is I want to implement full-text search functionality and after so much googling I did not found anything relevant. Right now I am using search with wild card and its working fine, but I want to implement full text search
Event.select('event_name,id').find(:all, :conditions => ['lower(event_name) LIKE ?', "%#{params[:keyword].downcase}%"])
Any help would be really appreciate able.
Take a look at this repo and the post:
https://github.com/casecommons/pg_search
pg_search: How I Learned to Stop Worrying and Love PostgreSQL full-text search

Acts_as_taggable_on implementation tutorial

I've been trying to allow for tags to be placed on posts so that I could partition them into different sections of my app. I've looked through various gems and have found that acts_as_taggable_on seems to be the most popular one. After various attempts of implementation from the examples in the github of the gem I have not been able to successfully use it. I've searched extensively for a tutorial on implementation but have found none and was hoping someone would have one for such a thing. I'm sorry for the simple question as I am still relatively new to programming.
Railscasts now has an excellent tutorial on acts_as_taggable.
This is also a nice and simple text intro on how to get it working.
There are a number of tutorials that are just fine. The one mentioned in the previous answer is a good one.
One point that is not obvious to someone new to the RoR world is that there is no actual column in the database for the tags on the target table. I have seen many folks add a "tags" column to their database. No need for that at all and it just confuses things.
When you add the "acts_as_taggable_on :tags" to the model it becomes a virtual column (I know its not a RoR way to express this but if you have a database background its easier to think this way).
If you are going to require that tags have owners follow the example on how to get an objects tags carefully. You can only get that objects tags via "tags_from". You will get a null if you try a simple tags_list.
Hope this helps

Good approach to a tagging system in Rails 3?

I'm trying to add tagging to my rails app - I'd rather not use a plugin/gem for this though.
My needs are pretty simple:
Users can add multiple tags to a single item, they can search for items by those tags, and they can see a page which lists all the tags they've used before.
What I'm wondering is, whats the best way to go about this? An array/hash in the model being tagged? A join table?
Any suggestions would be highly appreciated.
I would use a join table between the tags and the taggableItems. Then with a before_create you could check if the tag's are already in the system and create them if they aren't in the system. Next you could use searchlogic (i think there is a rails 3 branch on github) for easy tag/taggableItems searching. And it would be nice to give the user some feedback of the available tags with some autocompletion or a short list of most used tags but that is up to you/the design.
Maybe this helps you: Best Rails Tagging Plugin/Gem

Rails gem/plugin that gives suggestions how to optimize your DB queries

Some time ago I saw in a screencast showing a gem or plugin, which was able to suggest how to optimize your Rails DB queries, like where to use include or add an index and so on... Now I can't remember which screencast that was, but maybe somebody knows what I am talking about, I mean that gem/plugin.
Actually I have found it was on this screencast, and it is called bullet
You're probably thinking about https://github.com/eladmeidar/rails_indexes , possibly https://github.com/samdanavia/ambitious_query_indexer .
Good luck.
Was it rails_best_practices?
Now You can use my newly created gem 'query_optimizer'
You can optimize queries as Post.optimize_query(:comments)

Creating WYSIWYG form builder (รก la Wufoo) in Rails

I have to add Wufoo-like WYSIWYG form-builder functionality to a Rails webapp.
Does anyone know of good resources (gems/engines/plugins/example code) that would help?
this is not really an answer to your question, but I still can't add comments unfortunately, due to my reputation level, sorry :)
There is exact equivalent of such functionality in Drupal(php)
http://drupal.org/project/webform especially useful for contact forms, i.e. clients happy and don't bug me every time they want to adjust or even to add new inquiry form :)
Would be nice to have such gem/plugin if any? :P
Thanks.
I don't think creating such a app in rails would be a great idea.
Using AR, such an app would be creating migrations on the fly - which doesn't sound like a great thing to do.
AFAIK, wufoo uses php.

Resources