Created
May 16, 2013 13:31
-
-
Save mikecmpbll/5591748 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/decorators/models/my_engine/user_decorator.rb | |
MyEngine::User.class_eval do | |
def self.find_by_name str | |
where("CONCAT(#{table_name}.firstname, ' ', #{table_name}.surname) LIKE :s", { s: "%#{str}%" }) | |
end | |
end | |
# rails c | |
MyEngine::User.find_by_name "John" | |
NoMethodError: undefined method `find_by_name' for #<Class:0x007fcb85a45580> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment