Updating to the latest Mongoid association syntax
has_many_related => references_many belongs_to_related => referenced_in
This commit is contained in:
parent
d5c2494962
commit
8a17394223
@ -7,7 +7,7 @@ class AssetCollection
|
|||||||
field :slug
|
field :slug
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
belongs_to_related :site
|
referenced_in :site
|
||||||
embeds_many :assets
|
embeds_many :assets
|
||||||
|
|
||||||
## behaviours ##
|
## behaviours ##
|
||||||
|
@ -12,7 +12,7 @@ class ContentType
|
|||||||
field :api_enabled, :type => Boolean, :default => false
|
field :api_enabled, :type => Boolean, :default => false
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
belongs_to_related :site
|
referenced_in :site
|
||||||
embeds_many :contents, :class_name => 'ContentInstance' do
|
embeds_many :contents, :class_name => 'ContentInstance' do
|
||||||
def visible
|
def visible
|
||||||
@target.find_all { |c| c.visible? }
|
@target.find_all { |c| c.visible? }
|
||||||
|
@ -7,7 +7,7 @@ module Models
|
|||||||
|
|
||||||
included do
|
included do
|
||||||
|
|
||||||
belongs_to_related :content_type
|
referenced_in :content_type
|
||||||
|
|
||||||
field :templatized, :type => Boolean, :default => false
|
field :templatized, :type => Boolean, :default => false
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
class Layout < LiquidTemplate
|
class Layout < LiquidTemplate
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
has_many_related :pages
|
references_many :pages
|
||||||
embeds_many :parts, :class_name => 'PagePart'
|
embeds_many :parts, :class_name => 'PagePart'
|
||||||
|
|
||||||
## callbacks ##
|
## callbacks ##
|
||||||
|
@ -8,7 +8,7 @@ class LiquidTemplate
|
|||||||
field :value
|
field :value
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
belongs_to_related :site
|
referenced_in :site
|
||||||
|
|
||||||
## callbacks ##
|
## callbacks ##
|
||||||
before_validation :normalize_slug
|
before_validation :normalize_slug
|
||||||
|
@ -6,7 +6,7 @@ class Membership
|
|||||||
field :admin, :type => Boolean, :default => false
|
field :admin, :type => Boolean, :default => false
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
belongs_to_related :account
|
referenced_in :account
|
||||||
embedded_in :site, :inverse_of => :memberships
|
embedded_in :site, :inverse_of => :memberships
|
||||||
|
|
||||||
## validations ##
|
## validations ##
|
||||||
|
@ -16,8 +16,8 @@ class Page
|
|||||||
field :cache_strategy, :default => 'none'
|
field :cache_strategy, :default => 'none'
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
belongs_to_related :site
|
referenced_in :site
|
||||||
belongs_to_related :layout
|
referenced_in :layout
|
||||||
embeds_many :parts, :class_name => 'PagePart'
|
embeds_many :parts, :class_name => 'PagePart'
|
||||||
|
|
||||||
## callbacks ##
|
## callbacks ##
|
||||||
|
@ -10,12 +10,12 @@ class Site
|
|||||||
field :meta_description
|
field :meta_description
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
has_many_related :pages
|
references_many :pages
|
||||||
has_many_related :layouts
|
references_many :layouts
|
||||||
has_many_related :snippets
|
references_many :snippets
|
||||||
has_many_related :theme_assets
|
references_many :theme_assets
|
||||||
has_many_related :asset_collections
|
references_many :asset_collections
|
||||||
has_many_related :content_types
|
references_many :content_types
|
||||||
embeds_many :memberships
|
embeds_many :memberships
|
||||||
|
|
||||||
## validations ##
|
## validations ##
|
||||||
|
@ -15,7 +15,7 @@ class ThemeAsset
|
|||||||
mount_uploader :source, ThemeAssetUploader
|
mount_uploader :source, ThemeAssetUploader
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
belongs_to_related :site
|
referenced_in :site
|
||||||
|
|
||||||
## callbacks ##
|
## callbacks ##
|
||||||
before_validation :sanitize_slug
|
before_validation :sanitize_slug
|
||||||
|
@ -888,7 +888,7 @@ Gem::Specification.new do |s|
|
|||||||
"vendor/plugins/custom_fields/lib/custom_fields.rb",
|
"vendor/plugins/custom_fields/lib/custom_fields.rb",
|
||||||
"vendor/plugins/custom_fields/lib/custom_fields/custom_fields_for.rb",
|
"vendor/plugins/custom_fields/lib/custom_fields/custom_fields_for.rb",
|
||||||
"vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/embeds_many.rb",
|
"vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/embeds_many.rb",
|
||||||
"vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/has_many_related.rb",
|
"vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/references_many.rb",
|
||||||
"vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/proxy.rb",
|
"vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/associations/proxy.rb",
|
||||||
"vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/document.rb",
|
"vendor/plugins/custom_fields/lib/custom_fields/extensions/mongoid/document.rb",
|
||||||
"vendor/plugins/custom_fields/lib/custom_fields/field.rb",
|
"vendor/plugins/custom_fields/lib/custom_fields/field.rb",
|
||||||
|
@ -7,7 +7,7 @@ class Project
|
|||||||
field :name
|
field :name
|
||||||
field :description
|
field :description
|
||||||
|
|
||||||
has_many_related :people
|
references_many :people
|
||||||
embeds_many :tasks
|
embeds_many :tasks
|
||||||
|
|
||||||
custom_fields_for :people
|
custom_fields_for :people
|
||||||
|
Loading…
Reference in New Issue
Block a user