Forum: Italian Ruby user group Rails 4 relazioni condizioni parametri

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
A7dc140b5e5621083671e0452aead7f9?d=identicon&s=25 Marco M. (marcomd)
on 2015-09-11 16:38
Ciao bagai,
c'รจ un modo per farlo direttamente nella relazione?

has_many   :relationships, -> (object, {
where("start_relation <= ?", relation_date) }

p.relationships 1.month.ago

ho trovato questa soluzione ma non vorrei usare un campo fittizio es:

has_many   :relationships, -> (object) { where("start_relation <= ?",
object.dummy_date) }

p.dummy_date = 1.month.ago

altrimenti uso uno scope e amen!
This topic is locked and can not be replied to.