I am using the jnunemaker-validatable gem by way of mongomapper, and it seems that the error messages are not coming through mapped to the standard keys used in Activerecord's i18n file. I'm not 100% sure that jnunemaker-validatable is the issue here, just seems a likely candidate. Has anyone used this gem in a multi-lingual way with success?
Thanks,
Tom
Found the answer here:
http://groups.google.com/group/mongomapper/browse_thread/thread/ab1a99f472d51847
Short answer appears to be that it's not a feature at this time, but there are various workarounds to get you part of the way there, and a Gem that looks promising: https://github.com/jmonteiro/mongomapper_i18n
Related
client_side_validations was a widely used gem that automatically created realtime validations for your Rails' frontend based on your models' validations. Alas, it seems to be unmaintained now. Are there any similar, maintained alternatives out there?
You can use Judge Rails Gem: https://github.com/joecorcoran/judge and there are plugins to use with FormBuilder SimpleForm https://github.com/joecorcoran/judge-simple_form
parsley.js is really nice -http://parsleyjs.org/ and it's been made into a gem for rails here - https://github.com/mekishizufu/parsley-rails
You can also use jQuery.validation. Although I think parsley looks a little better.
I need to consume resources from a REST api, and I'm trying to find a good gem for doing this, but I can't find anything good...
What do you use for this??
I use the REST Client gem for this - it's worked well so far.
I use Active Resource. (But Active Resource is too short an answer since StackOverflow requires that answers be at least 30 characters.)
I'm not pleased with Net::HTTP at all, and I'm looking for a lightweight gem that will either replace that library or at the very least hide it from me.
Does anyone have any suggestions?
My vote goes to HTTParty. It's incredibly simple to use and can be as powerful as you choose. Here's a code sample:
HTTParty.get("http://maps.googleapis.com/maps/api/distancematrix/json?origins=New+York+NY&destinations=Los+Angeles+CA&mode=car&language=en&sensor=false")
Pretty simple stuff depending on what you're using it for.
Try the RestClient gem:
https://github.com/archiloque/rest-client
There are a few out there.
Ruby toolbox has a http client list: http://ruby-toolbox.com/categories/http_clients.html
Personally I usually use HTTParty... or sometimes Mechanize, it's good for submitting forms
I would recommend checking the docs of each, to see which one suits your purpose best.
Hope this helps.
You might want to check out the rest gem, it was created and tested so we could find the best performing http gems by wrapping those gems and creating a standard interface to them. Turns out HTTParty and RestClient are very slow gems so I wouldn't recommend those, although you can always swap out the underlying gem in rest to see for yourself without having to change your code (other than initialization). rest gem by default will be much, much faster.
It's also very easy to use:
#rest = Rest::Client.new()
#rest.get(url, options...)
More info: https://github.com/iron-io/rest
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)
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?