Updating to the latest Mongoid association syntax

has_many_related => references_many
belongs_to_related => referenced_in
This commit is contained in:
Jacques Crocker 2010-07-30 19:15:24 -07:00
parent d5c2494962
commit 8a17394223
11 changed files with 23 additions and 23 deletions

View File

@ -7,7 +7,7 @@ class AssetCollection
field :slug
## associations ##
belongs_to_related :site
referenced_in :site
embeds_many :assets
## behaviours ##

View File

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

View File

@ -7,7 +7,7 @@ module Models
included do
belongs_to_related :content_type
referenced_in :content_type
field :templatized, :type => Boolean, :default => false

View File

@ -1,7 +1,7 @@
class Layout < LiquidTemplate
## associations ##
has_many_related :pages
references_many :pages
embeds_many :parts, :class_name => 'PagePart'
## callbacks ##

View File

@ -8,7 +8,7 @@ class LiquidTemplate
field :value
## associations ##
belongs_to_related :site
referenced_in :site
## callbacks ##
before_validation :normalize_slug

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@ class ThemeAsset
mount_uploader :source, ThemeAssetUploader
## associations ##
belongs_to_related :site
referenced_in :site
## callbacks ##
before_validation :sanitize_slug

View File

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

View File

@ -7,7 +7,7 @@ class Project
field :name
field :description
has_many_related :people
references_many :people
embeds_many :tasks
custom_fields_for :people