Embedded to referenced for users
This commit is contained in:
parent
83827f82ec
commit
6a196c5d3d
|
@ -7,7 +7,7 @@ class Attribute
|
||||||
field :built_in, :type => Boolean, :default => false
|
field :built_in, :type => Boolean, :default => false
|
||||||
field :disabled, :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
|
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
|
accepts_nested_attributes_for :attribute_fields, :allow_destroy => true
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class AttributeField
|
||||||
field :built_in, :type => Boolean, :default => false
|
field :built_in, :type => Boolean, :default => false
|
||||||
field :disabled, :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_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_many :attribute_values
|
has_many :attribute_values
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Role
|
||||||
field :built_in, :type => Boolean, :default => false
|
field :built_in, :type => Boolean, :default => false
|
||||||
field :disabled, :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_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_many :users
|
has_many :users
|
||||||
accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
|
accepts_nested_attributes_for :i18n_variable, :allow_destroy => true
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class SubRole < Attribute
|
class SubRole < Attribute
|
||||||
|
|
||||||
embedded_in :role
|
belongs_to :role
|
||||||
has_and_belongs_to_many :users
|
has_and_belongs_to_many :users
|
||||||
|
|
||||||
# Get an sub_role from key
|
# Get an sub_role from key
|
||||||
|
|
Reference in New Issue