Embed attribute_fields and sub_roles
This commit is contained in:
parent
4d2809d40b
commit
9ea613cf4e
|
@ -7,7 +7,7 @@ class Attribute
|
|||
field :built_in, :type => Boolean, :default => false
|
||||
field :disabled, :type => Boolean, :default => false
|
||||
|
||||
has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
||||
embeds_many :attribute_fields, :cascade_callbacks => true
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class AttributeField
|
|||
field :built_in, :type => Boolean, :default => false
|
||||
field :disabled, :type => Boolean, :default => false
|
||||
|
||||
belongs_to :attribute
|
||||
embedded_in :attribute
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_many :attribute_values
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class Role
|
|||
field :built_in, :type => Boolean, :default => false
|
||||
field :disabled, :type => Boolean, :default => false
|
||||
|
||||
has_many :sub_roles, :autosave => true, :dependent => :destroy
|
||||
embeds_many :sub_roles, :cascade_callbacks => true
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_many :users
|
||||
accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class SubRole < Attribute
|
||||
|
||||
belongs_to :role
|
||||
embedded_in :role
|
||||
has_and_belongs_to_many :users
|
||||
|
||||
# Get an sub_role from key
|
||||
|
|
Loading…
Reference in New Issue