Open johansmitsnl opened 6 years ago
Structure question
I'm trying to implement a offer calculator.
I have a structure in the database:
class SubscriptionOffer < ApplicationRecord has_many :subjects, class_name: 'SubscriptionOffer::Subject' end class SubscriptionOffer::Subject < ApplicationRecord belongs_to :offer, class_name: 'SubscriptionOffer', foreign_key: :subscription_offer_id has_many :items, class_name: 'SubscriptionOffer::Subject::Item', foreign_key: :subscription_offer_subject_id end class SubscriptionOffer::Subject::Item < ApplicationRecord belongs_to :subject, class_name: 'SubscriptionOffer::Subject', foreign_key: :subscription_offer_subject_id end
The component:
SubscriptionOffer.last.subjects.each do |subject| DIV do subject.component end end
Adding regulate will make it work:
class SubscriptionOffer < ApplicationRecord has_many :subjects, class_name: 'SubscriptionOffer::Subject', regulate: :always_allow end
Structure question
I'm trying to implement a offer calculator.
I have a structure in the database:
The component:
Adding regulate will make it work: