Hey guys, I was told to move discussion to the mailing list so that is what I am doing. I recently started working with merb and datamapper and I am really fond of moving the super simple conditions syntax over to rails.
Here is the (closed) ticket:
Here are some examples of the syntax in action:
Person.find(:all, :conditions => { :age.gt => 30, :name.like => "%name%" }) Person.all(:conditions => { :name => "Bob", :age.gt => 25 }) # returns all records that match 'all' conditions Person.all(:conditions => { :name.eql => "Bob", :age.gt => 25 }) Person.all(:conditions => { :name.like => "%ob%", :age.lte => 55 }) Person.all(:conditions => { :name.like => "%ob%", :age.in => [55, 56, 57] }) Person.all(:conditions => { :name.like => "%ob%", :age.not => [55, 56, 57] })
While, I have built a plugin that works with Rails 2.1 and below, this functionality is so simple and so elegant, I am interested in trying to get this into rails core.
Also, I find that this area is constantly changing which requires constant maintenance of the plugin. I believe this simple fix would be better suited to being in rails and it would benefit a lot of people when they first start building queries.
The plugin is here: http://github.com/xgamerx/conditions_fu/tree/master
If I was willing to create the patch and the associated tests, would this be able to be accepted into rails? Any thoughts or suggestions on the matter?