diff --git a/app/models/user/attribute.rb b/app/models/user/attribute.rb index 84650421..af8a1106 100644 --- a/app/models/user/attribute.rb +++ b/app/models/user/attribute.rb @@ -7,7 +7,7 @@ class Attribute field :built_in, :type => Boolean, :default => false field :disabled, :type => Boolean, :default => false - embeds_many :attribute_fields, :cascade_callbacks => true + has_many :attribute_fields, :autosave => true, :dependent => :destroy has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :attribute_fields, :allow_destroy => true diff --git a/app/models/user/attribute_field.rb b/app/models/user/attribute_field.rb index 2d909b3e..42bbf910 100644 --- a/app/models/user/attribute_field.rb +++ b/app/models/user/attribute_field.rb @@ -10,7 +10,7 @@ class AttributeField field :built_in, :type => Boolean, :default => false field :disabled, :type => Boolean, :default => false - embedded_in :attribute + belongs_to :attribute has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy has_many :attribute_values diff --git a/app/models/user/role.rb b/app/models/user/role.rb index 788d281d..86f7266f 100644 --- a/app/models/user/role.rb +++ b/app/models/user/role.rb @@ -7,7 +7,7 @@ class Role field :built_in, :type => Boolean, :default => false field :disabled, :type => Boolean, :default => false - embeds_many :sub_roles, :cascade_callbacks => true + has_many :sub_roles, :autosave => true, :dependent => :destroy has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy has_many :users accepts_nested_attributes_for :i18n_variable, :allow_destroy => true diff --git a/app/models/user/sub_role.rb b/app/models/user/sub_role.rb index 47f3e2de..cdefb5f5 100644 --- a/app/models/user/sub_role.rb +++ b/app/models/user/sub_role.rb @@ -1,6 +1,6 @@ class SubRole < Attribute - embedded_in :role + belongs_to :role has_and_belongs_to_many :users # Get an sub_role from key