I have a Author model that has_many Books.
I've overridden Books to be able to be found by their title
class Book < ActiveRecord::Base
...
def self.find(input)
if input.is_a?(Integer) || input.integer?
super(input)
else
return Book.find_by_title(input)
end
end
...
end
This works fine in most cases, but if I do something like author.books.find("Some Book Title")
this method doesn't seem to be called.
Is there any way to fix this?