method

method_missing

Importance_1
v3.1.0 - Show latest stable - 0 notes - Class: ActiveRecord::Base
method_missing(method_id, *arguments, &block) private

Enables dynamic finders like User.find_by_user_name(user_name) and <tt>User.scoped_by_user_name(user_name). Refer to Dynamic attribute-based finders section at the top of this file for more detailed information.

It’s even possible to use all the additional parameters to find. For example, the full interface for find_all_by_amount is actually find_all_by_amount(amount, options).

Each dynamic finder using scoped_by_* is also defined in the class after it is first invoked, so that future attempts to use it do not run through method_missing.

Show source
Register or log in to add new notes.