I have a Rails 4 app which has a Devise user. The Devise user can create multiple Apps and each App can contain multiple Certificates. At any given time tho and App can only have one production_certificate and one development_certificate. I believe that i setup the associations correctly here they are. My trouble now is how can i set the App to use one out of the many Certificates that an app owns to be the production/development certificate.
class App < ActiveRecord::Base
belongs_to :user
has_many :certificates
belongs_to :production_certificate, class_name: 'Certificate'
belongs_to :development_certificate, class_name: 'Certificate'
end
class Certificate < ActiveRecord::Base
belongs_to :app
end