# plugin help

**URL:** <https://discuss.rubyonrails.org/t/plugin-help/49100>\
**Category:** rubyonrails-talk\
**Created:** [February 3, 2010, 10:57pm UTC](https://discuss.rubyonrails.org/t/plugin-help/49100 "2010-02-03T22:57:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Habgood](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@Chris\_Habgood](https://discuss.rubyonrails.org/u/Chris_Habgood)\
**Post date:** [February 3, 2010, 10:57pm UTC](https://discuss.rubyonrails.org/t/plugin-help/49100/1 "2010-02-03T22:57:40Z")

</div>

I am trying to do an active record find method. When I call it from the console it says method\_missing.

Ideas?

init.rb

require 'find\_by\_like' ActiveRecord::Base.send(:include, CH::FIND::LIKE

find\_by\_like.rb module CH &nbsp;&nbsp;module FIND #:nodoc: &nbsp;&nbsp;&nbsp;&nbsp;module LIKE #:nodoc:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def self.included(base) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.send :extend, ClassMethods &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;module ClassMethods

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def find\_by\_like(col,name) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query = ":all, :conditions =\> ['#{col} like %?%', #{name}]" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.find(query) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end end

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 3, 2010, 11:20pm UTC](https://discuss.rubyonrails.org/t/plugin-help/49100/2 "2010-02-03T23:20:57Z")

</div>

Chris Habgood wrote:

> I am trying to do an active record find method. When I call it from the console it says method\_missing.

No, it probably doesn't. Please post the exact error message.

> Ideas?
> 
> init.rb
> 
> require 'find\_by\_like' ActiveRecord::Base.send(:include, CH::FIND::LIKE
> 
> find\_by\_like.rb module CH &nbsp;&nbsp;module FIND #:nodoc: &nbsp;&nbsp;&nbsp;&nbsp;module LIKE #:nodoc:

Don't use all caps for your module names.

> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def self.included(base) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base.send :extend, ClassMethods &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;module ClassMethods
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def find\_by\_like(col,name) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query = ":all, :conditions =\> ['#{col} like %?%', #{name}]"

That should be a hash, not a string.

> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.find(query) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
> 
> &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end end

Best,

---

<div class="post-metadata">

**Author:** ![Chris\_Habgood](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@Chris\_Habgood](https://discuss.rubyonrails.org/u/Chris_Habgood)\
**Post date:** [February 3, 2010, 11:43pm UTC](https://discuss.rubyonrails.org/t/plugin-help/49100/3 "2010-02-03T23:43:57Z")

</div>

undefined method `find\_by\_like’

---

<div class="post-metadata">

**Author:** ![Chris\_Habgood](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@Chris\_Habgood](https://discuss.rubyonrails.org/u/Chris_Habgood)\
**Post date:** [February 4, 2010, 1:06am UTC](https://discuss.rubyonrails.org/t/plugin-help/49100/4 "2010-02-04T01:06:20Z")

</div>

Why is it not recognizing the method?
