summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2010-01-14 22:21:43 +0100
committerhukl <contact@smyck.org>2010-01-14 22:21:43 +0100
commit57d1382013c85a7b11ac8ce5e683f6006b12b328 (patch)
tree19646c4fa5952fa1cf0a2c874952affa346373f1 /app
parent1b86bf5f2e35d1820bfa32d979bcc2d9ff9a9a8e (diff)
Updated globalize2 to latest version. Modified existing code accoringly
Diffstat (limited to 'app')
-rw-r--r--app/models/node.rb2
-rw-r--r--app/models/page.rb14
2 files changed, 8 insertions, 8 deletions
diff --git a/app/models/node.rb b/app/models/node.rb
index 4f67dcb..db44b71 100644
--- a/app/models/node.rb
+++ b/app/models/node.rb
@@ -25,7 +25,7 @@ class Node < ActiveRecord::Base
25 25
26 # Index for Fulltext Search 26 # Index for Fulltext Search
27 define_index do 27 define_index do
28 indexes head.globalize_translations.title 28 indexes head.translations.title
29 indexes slug 29 indexes slug
30 indexes unique_name 30 indexes unique_name
31 end 31 end
diff --git a/app/models/page.rb b/app/models/page.rb
index 37b221e..a993e31 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -10,14 +10,14 @@ class Page < ActiveRecord::Base
10 named_scope( 10 named_scope(
11 :drafts, 11 :drafts,
12 :joins => :node, 12 :joins => :node,
13 :include => [:globalize_translations], 13 :include => [:translations],
14 :conditions => ["nodes.draft_id = pages.id"] 14 :conditions => ["nodes.draft_id = pages.id"]
15 ) 15 )
16 16
17 named_scope( 17 named_scope(
18 :heads, 18 :heads,
19 :joins => :node, 19 :joins => :node,
20 :include => [:globalize_translations], 20 :include => [:translations],
21 :conditions => ["nodes.head_id = pages.id"] 21 :conditions => ["nodes.head_id = pages.id"]
22 ) 22 )
23 23
@@ -89,7 +89,7 @@ class Page < ActiveRecord::Base
89 # outdated_translations? for more information. 89 # outdated_translations? for more information.
90 # Takes :locale => <locale> and :delta_time => 12.hours as options 90 # Takes :locale => <locale> and :delta_time => 12.hours as options
91 def self.find_with_outdated_translations options = {} 91 def self.find_with_outdated_translations options = {}
92 Page.all(:include => :globalize_translations).select do |page| 92 Page.all(:include => :translations).select do |page|
93 page.outdated_translations? options 93 page.outdated_translations? options
94 end 94 end
95 end 95 end
@@ -132,11 +132,11 @@ class Page < ActiveRecord::Base
132 self.published_at = page.published_at 132 self.published_at = page.published_at
133 133
134 # Getting rid of the auto-generated empty translations 134 # Getting rid of the auto-generated empty translations
135 self.globalize_translations.delete_all 135 self.translations.delete_all
136 136
137 # Clone translated attributes 137 # Clone translated attributes
138 page.globalize_translations.each do |translation| 138 page.translations.each do |translation|
139 self.globalize_translations.create!(translation.attributes) 139 self.translations.create!(translation.attributes)
140 end 140 end
141 141
142 # Clone asset references 142 # Clone asset references
@@ -163,7 +163,7 @@ class Page < ActiveRecord::Base
163 163
164 options = default_options.merge options 164 options = default_options.merge options
165 165
166 translations = self.globalize_translations 166 translations = self.translations
167 167
168 default = *(translations.select {|x| x.locale == I18n.default_locale}) 168 default = *(translations.select {|x| x.locale == I18n.default_locale})
169 custom = *(translations.select {|x| x.locale == options[:locale]}) 169 custom = *(translations.select {|x| x.locale == options[:locale]})