diff --git a/app/models/asset_collection.rb b/app/models/asset_collection.rb index ab4d6171..8b4ad8e7 100644 --- a/app/models/asset_collection.rb +++ b/app/models/asset_collection.rb @@ -7,7 +7,7 @@ class AssetCollection field :slug ## associations ## - belongs_to_related :site + referenced_in :site embeds_many :assets ## behaviours ## diff --git a/app/models/content_type.rb b/app/models/content_type.rb index 99b9f355..b0725e76 100644 --- a/app/models/content_type.rb +++ b/app/models/content_type.rb @@ -12,7 +12,7 @@ class ContentType field :api_enabled, :type => Boolean, :default => false ## associations ## - belongs_to_related :site + referenced_in :site embeds_many :contents, :class_name => 'ContentInstance' do def visible @target.find_all { |c| c.visible? } diff --git a/app/models/extensions/page/templatized.rb b/app/models/extensions/page/templatized.rb index 7ac030f3..8003f4c5 100644 --- a/app/models/extensions/page/templatized.rb +++ b/app/models/extensions/page/templatized.rb @@ -7,7 +7,7 @@ module Models included do - belongs_to_related :content_type + referenced_in :content_type field :templatized, :type => Boolean, :default => false diff --git a/app/models/layout.rb b/app/models/layout.rb index bf90b9a0..af8aa4b9 100644 --- a/app/models/layout.rb +++ b/app/models/layout.rb @@ -1,7 +1,7 @@ class Layout < LiquidTemplate ## associations ## - has_many_related :pages + references_many :pages embeds_many :parts, :class_name => 'PagePart' ## callbacks ## diff --git a/app/models/liquid_template.rb b/app/models/liquid_template.rb index d80b8194..9f862b01 100644 --- a/app/models/liquid_template.rb +++ b/app/models/liquid_template.rb @@ -8,7 +8,7 @@ class LiquidTemplate field :value ## associations ## - belongs_to_related :site + referenced_in :site ## callbacks ## before_validation :normalize_slug diff --git a/app/models/membership.rb b/app/models/membership.rb index 0a710ff2..7e89b5d1 100644 --- a/app/models/membership.rb +++ b/app/models/membership.rb @@ -6,7 +6,7 @@ class Membership field :admin, :type => Boolean, :default => false ## associations ## - belongs_to_related :account + referenced_in :account embedded_in :site, :inverse_of => :memberships ## validations ## diff --git a/app/models/page.rb b/app/models/page.rb index a91e1118..02788e49 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -16,8 +16,8 @@ class Page field :cache_strategy, :default => 'none' ## associations ## - belongs_to_related :site - belongs_to_related :layout + referenced_in :site + referenced_in :layout embeds_many :parts, :class_name => 'PagePart' ## callbacks ## diff --git a/app/models/site.rb b/app/models/site.rb index 79839f7f..76edcc94 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -10,12 +10,12 @@ class Site field :meta_description ## associations ## - has_many_related :pages - has_many_related :layouts - has_many_related :snippets - has_many_related :theme_assets - has_many_related :asset_collections - has_many_related :content_types + references_many :pages + references_many :layouts + references_many :snippets + references_many :theme_assets + references_many :asset_collections + references_many :content_types embeds_many :memberships ## validations ## diff --git a/app/models/theme_asset.rb b/app/models/theme_asset.rb index feb12932..1bf5880b 100644 --- a/app/models/theme_asset.rb +++ b/app/models/theme_asset.rb @@ -15,7 +15,7 @@ class ThemeAsset mount_uploader :source, ThemeAssetUploader ## associations ## - belongs_to_related :site + referenced_in :site ## callbacks ## before_validation :sanitize_slug diff --git a/locomotive_cms.gemspec b/locomotive_cms.gemspec index f806e54c..e032aa80 100644 --- a/locomotive_cms.gemspec +++ b/locomotive_cms.gemspec @@ -888,7 +888,7 @@ Gem::Specification.new do |s| "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/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/document.rb", "vendor/plugins/custom_fields/lib/custom_fields/field.rb", diff --git a/vendor/plugins/custom_fields/spec/models/project.rb b/vendor/plugins/custom_fields/spec/models/project.rb index 28928aef..0ddd1ee2 100644 --- a/vendor/plugins/custom_fields/spec/models/project.rb +++ b/vendor/plugins/custom_fields/spec/models/project.rb @@ -1,18 +1,18 @@ class Project - + include Mongoid::Document include CustomFields::ProxyClassEnabler include CustomFields::CustomFieldsFor - + field :name field :description - - has_many_related :people + + references_many :people embeds_many :tasks - + custom_fields_for :people custom_fields_for :tasks - + named_scope :ordered, :order_by => [[:name, :asc]] - + end \ No newline at end of file