reflect_on_association

reflect_on_association(association) Instance Public methods Returns the AssociationReflection object for the association (use the symbol). Account.reflect_on_association(:owner) # returns the owner AssociationReflection Invoice.reflect_on_association(:line_items).macro # returns :has_many @api public

reflect_on_all_autosave_associations

reflect_on_all_autosave_associations() Instance Public methods Returns an array of AssociationReflection objects for all associations which have :autosave enabled. @api public

reflect_on_all_associations

reflect_on_all_associations(macro = nil) Instance Public methods Returns an array of AssociationReflection objects for all the associations in the class. If you only want to reflect on a certain association type, pass in the symbol (:has_many, :has_one, :belongs_to) as the first parameter. Example: Account.reflect_on_all_associations # returns an array of all associations Account.reflect_on_all_associations(:has_many) # returns an array of all has_many associations @a

reflect_on_all_aggregations

reflect_on_all_aggregations() Instance Public methods Returns an array of AggregateReflection objects for all the aggregations in the class.

reflect_on_aggregation

reflect_on_aggregation(aggregation) Instance Public methods Returns the AggregateReflection object for the named aggregation (use the symbol). Account.reflect_on_aggregation(:balance) # => the balance AggregateReflection

readonly_attributes

readonly_attributes() Instance Public methods Returns an array of all the attributes that have been specified as readonly.

attr_readonly

attr_readonly(*attributes) Instance Public methods Attributes listed as readonly will be used to create a new record but update operations will ignore these fields.

where

where(opts = :chain, *rest) Instance Public methods Returns a new relation, which is the result of filtering the current relation according to the conditions in the arguments. where accepts conditions in one of several formats. In the examples below, the resulting SQL is given as an illustration; the actual query generated may be different depending on the database adapter. string A single string, without additional arguments, is passed to the query constructor as an SQL fragment,

unscope

unscope(*args) Instance Public methods Removes an unwanted relation that is already defined on a chain of relations. This is useful when passing around chains of relations and would like to modify the relations without reconstructing the entire chain. User.order('email DESC').unscope(:order) == User.all The method arguments are symbols which correspond to the names of the methods which should be unscoped. The valid arguments are given in VALID_UNSCOPING_VALUES. The method can also

uniq

uniq(value = true) Instance Public methods Alias for: distinct