Override .find, .find_by_id, etc...

I read these:

http://www.freezzo.com/2008/05/14/override-default-find-conditions-for-model/

it works, it override the .find perfectly, however it does not cover .find_by_id or other .find_by_XXX

Is there anyway to override all the find function of a modal? I want to set the default "select" for User modal, only return name and id, but not the password by default.

Thanks

I read these:How to properly override ActiveRecord::Base.find - Rails - Ruby-Forum

it works, it override the .find perfectly, however it does not cover .find_by_id or other .find_by_XXX

Is there anyway to override all the find function of a modal? I want to set the default "select" for User modal, only return name and id, but not the password by default.

default_scope ?

The methods linked above should also work in recent versions of rails - find_by_xxx used to call find_every/find_initial directly but now calls find.

Fred

Thanks! I am using a very old version rails... thats why it does not work... I tested on new version rails and it works, happy now =)

Leonardo

Frederick Cheung wrote: