gem install ar-extensions
What’s New?
- 0 includes:
- support for arrays when using the Hash arguments and the ‘_contains’ suffix.
- a synchronize method which acts like ActiveRecord::Base#reload, but it works on multiple instances. The benefit being that it makes one query to reload all instances rather then one query per instance
- a bug fix for URI encoded strings when using find with ActiveRecord objects
Examples
# synchronize example
post = BlogPost.find_by_author_name( 'zdennis' )
columns = [ :author_name, :title ]
values = [ [ 'yoda', 'test post' ] ]
BlogPost.import columns, values, :synchronize=>[ post ]
post.author_name # => 'yoda'
# using synchronize option with import
posts = BlogPost.find(:all)
BlogPost.import( columns, values, :synchronize=>posts)
# using arrays with the _contains suffix
BlogPost.find(
:all,
:conditions=>{ :author_name_contains=>[ 'ab', 'oc', 'ed' ] } )
Questions, Comments
zach dot dennis at gmail dot com
blog comments powered by Disqus