Rails gem/plugin that gives suggestions how to optimize your DB queries - ruby-on-rails

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)

Related

Rails 3 Autocomplete - Suggesting Alternatives?

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.

Solutions for cron jobs in rails3

I'm trying to log some data daily, automatically in my rails app. I was wonder if anyone knows a good solution for this? I found https://github.com/javan/whenever, but I wanted to make sure I knew of all the options before I chose.
Thanks!
Elliot
I really like whenever - it's a great Gem and I have used it in production.
There is also a good Railscasts episode about it:
http://railscasts.com/episodes/164-cron-in-ruby

Standard Rails Gem for storing what User created/updated/deleted any Record?

What's the standard/best option out there for this kind of version control? The main thing I'm looking for is to track what user edited a record.
I've seen these so far and am wondering what your take is:
PaperTrail
ActsAsAudited
VestalVersions
The plugins you mentioned all seem to take the same approach, and seem to be somewhat similar in approach: use a seperate table to store the old versions.
None of them seem to be really rails3-ready (looking at the generators), but PaperTrail reportedly should work with rails3, and has the most recent commit.
You could also look at the ruby-toolbox user-stamping and versioning. There you can see which project has the most "traction", which has the most recent commits. Which sometimes can help to make a choice between similar options.
For stamping user_ids onto rows there is the the userstamp plugin
http://github.com/delynn/userstamp
EDIT:
Based on the requirement mentioned in your comment, I would recommend act_as_audited
http://github.com/collectiveidea/acts_as_audited
We are using it successfully for a very large application.
Peer
I think PaperTrail is what you need to solve this problem.
With PaperTrail you can track and see all changes ,to any model, with user id of who made the changes.
It is currently the best maintained project of the three you linked
HI #viatropos I thought that these two links might prove to be helpful
http://api.rubyonrails.org/classes/ActiveRecord/Observer.html
http://www.robbyonrails.com/articles/2007/04/27/observers-big-and-small

Which CouchDB API to use for Rails?

I am currently investigating possible applications of CouchDB on my current project (written in Rails) and would like to get some feedback from people who have actually used these APIs. Which would you recommend and why?
ActiveCouch
CouchFoo
CouchRest
CouchRest-Rails
CouchPotato
The basic layer of CouchRest is probably the best to get started, CouchPotato is the most active for Rails integration, SimplyStored adds some nicities on top of CouchPotato
With Rails 3 use (or at least seriously consider using) CouchRest Model. It appears to be well maintained, since as of this update on 2013/12/19 I see several changes that are only 2 weeks old.
Before considering SimplyStored, you should note that they give this warning on Github:
Development work as stopped as we don't use SimplyStored anymore. Please do not expect any future commits and fixes.
Perhaps someone will pick it up, as it looks very useful.
I am going through the same process. You might find SimplyStored interesting if you haven't already given it a look.
http://github.com/peritor/simply_stored

Acts_as_paranoid, is_paranoid... Alternatives?

I'm looking for a rails plugin/gem which brings the functionality of marking an ActiveRecord-Model deleted, instead of deleteing it.
Does anybody know, what gems or plugins are up to date? (AAP is out-dated and is_paranoid doesn't appear to be used by the community).
Do you know alternatives?
It seems even the authors of both acts_as_paranoid and is_paranoid aren't using their respective plugins/gems any more. Both are using named scopes.
Yeah, it's not automagic or anything, but sometimes being explicit about your intentions is a good thing.
For completeness, here is a more recent gem for this purpose:
Paranoia - acts_as_paranoid for Rails 3
https://github.com/radar/paranoia
And another:
https://github.com/JackDanger/permanent_records
is_paranoid doesn't appear to be used by the community..
http://chadfowler.com/blog/2009/07/08/how-ruby-mixins-work-with-inheritance/ - Just a blog post the other day talking about it. Seems like it solved Chad's problem just fine (as well as lead him to write a post about inheritance and mixins).
How about you just have a valid:boolean column/attribute and set it to false when you wish to soft-delete the model? Or am I missing something?

Resources