こんにちは私は3つのモデルを持っています:会社、プラン、サブスクリプションと次の協会
class Company < ActiveRecord::Base
has_one :plan, :through => :subscriptions
has_many :subscriptions
end
class Subscription < ActiveRecord::Base
belongs_to :plan
belongs_to :company
end
class Plan < ActiveRecord::Base
has_many :subscriptions
has_many :companies, :through => :subscriptions
end
アプリケーションプラン「A」とプラン「B」に2つのプランがあります。プラン「A」は無料で、「B」には料金がかかります。ここで、プラン「A」の会社とプラン「B」の会社を登録したいと思います。
私は自分のモデルにこのデータが欲しいのですが、これは間違いなくすべてを取得する簡単な方法ですが、私が使用したすべてのものは正しいデータを提供していません。どんな助けでもありがたいです。