Embed attribute_fields and sub_roles

This commit is contained in:
Christophe Vilayphiou 2012-01-16 08:14:05 +08:00
parent 4d2809d40b
commit 9ea613cf4e
4 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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