Sha256: d07201db2c2d83cf2343f457da8007e5e871b950eb4a29b4b79528ade3819e71

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 Bytes

Contents

= Inequal Opportunity

ActiveRecord is a ruby ORM released with Ruby on Rails.  It has a hash syntax
for specifying SQL conditions:

  YourModel.count(:conditions => {:id => 5})
  YourModel.all(:limit => 5, :order => :created_at, :conditions => {:user_id => 5})

But this hash format lacks inequalities.  In order to generate:

  SELECT * from your_models where id <> '42';

You have to write:

  YourModel.count(:conditions => ['id <> ?', 42])

With Inequal Opportunity, you can write:

  YourModel.count(:conditions => {:id => ne(42)})

Where Object#ne wraps 42 in a ActiveRecord::Inequality::NotEqual class,
which is then used to insert the proper operator into the generated SQL.

Test coverage is real sparse right now.  I also am not completely satisfied with
the way I overwrite ActiveRecord.expand_range_bind_variables, but it works for now.


== License

Inequal Opportunity is released under the MIT license.


== Support

Just email me at ryan@angilly.com with questions, bugs,
or patches

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ryana-inequal_opportunity-0.1.0 README
ryana-inequal_opportunity-0.1.1 README