# ActiveResource/ActiveRecord arg name difference

**URL:** <https://www.ruby-forum.com/t/activeresource-activerecord-arg-name-difference/105687>\
**Category:** Rails\
**Created:** [June 1, 2007, 11:59am UTC](https://www.ruby-forum.com/t/activeresource-activerecord-arg-name-difference/105687 "2007-06-01T11:59:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![el-oy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/958977/32.png) [@el-oy](https://www.ruby-forum.com/u/el-oy)\
**Post date:** [June 1, 2007, 11:59am UTC](https://www.ruby-forum.com/t/activeresource-activerecord-arg-name-difference/105687/1 "2007-06-01T11:59:31Z")

</div>

Hello,

I’m currently working on some code to support ActiveResource in  
RubyCocoa with Cocoa Bindings.  
I have already written (most) of the glue for ActiveRecord, so obviously  
I want to keep my code DRY and reuse most of the glue code.

During this I noticed that there’s a difference in argument naming  
between the two.  
In ActiveRecord when using the find class method you would use  
:conditions to, well you know set the conditions 🙂  
e.g.: Foo.find :all, :conditions =\> { :bar =\> ‘baz’ }

However in ActiveResource you are supposed to use the :params key.  
e.g.: Foo.find :all, :params =\> { :bar =\> ‘baz’ }

I can understand how you would call them :params in ActiveResource  
because they are going to be send as parameters. But I find it more  
consistent if at least ActiveResource would also accept the :conditions  
key. This would also allow me to use ducktyping on them, which is what  
I’m doing.

So atm I’ve added my own workaround to ActiveResource::Base, but I could  
whip up a patch for it, that would either rename the :params to  
:conditions key, or simply duplicate them like in my workaround, if  
necessary?

class \<\< self  
alias\_method : **find** , :find  
def find(\*args)  
args[1][:params] = args[1][:conditions] unless args[1].nil?  
**find** (\*args)  
end  
end

Cheers,  
Eloy
