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 field :slug
## associations ## ## associations ##
belongs_to_related :site referenced_in :site
embeds_many :assets embeds_many :assets
## behaviours ## ## behaviours ##

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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