whereThe where method lets you specify the conditions that the associated object must meet.
class Customer < ActiveRecord::Base has_many :confirmed_orders, -> { where "confirmed = 1" }, class_name: "Order"end |
--
You received this message because you are subscribed to a topic in the Google Groups "Hobo Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hobousers/LFPHsqTg8p0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hobousers+...@googlegroups.com.
To post to this group, send email to hobo...@googlegroups.com.
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.
belongs_toThere may be times when you wish to customize the query used by belongs_to. Such customizations can be achieved via a scope block. For example:
class Order < ActiveRecord::Base belongs_to :customer, -> { where active: true }, dependent: :destroyend |
-Owen
Owen Dall
Vice President | Chief Technology Officer
Barquin International
Office: 202.296.7147 | Mobile: 410.991.0811
Fax: 202.296.8903 | email: od...@barquin.com
![]()
NOTICE: If you have received this message in error, please contact the sender immediately and be aware that the use, copying, or dissemination of this information is prohibited. This email transmission contains information from Barquin International that may be considered privileged or confidential and is intended solely for the named recipient.
--
You received this message because you are subscribed to the Google Groups "Hobo Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hobousers+...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Hobo Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hobousers/LFPHsqTg8p0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hobousers+...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to hobousers+...@googlegroups.com.