Answer the question
In order to leave comments, you need to log in
Electoral association in RoR
There are 2 models. It is necessary to make it so that the many-to-one association of the second model with the first is set only when a certain value is found in the field of the first model,
can this be implemented?
Answer the question
In order to leave comments, you need to log in
If I understand the question correctly, then it is done like this:
class Customer < ActiveRecord::Base
has_many :confirmed_orders, :class_name => "Order", :conditions => "confirmed = 1"
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question