aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/seeds/refinerycms_blog.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/db/seeds/refinerycms_blog.rb b/db/seeds/refinerycms_blog.rb
index 9686c7f..0be2a06 100644
--- a/db/seeds/refinerycms_blog.rb
+++ b/db/seeds/refinerycms_blog.rb
@@ -1,18 +1,20 @@
-User.find(:all).each do |user|
+::User.find(:all).each do |user|
if user.plugins.where(:name => 'refinerycms_blog').blank?
user.plugins.create(:name => "refinerycms_blog",
:position => (user.plugins.maximum(:position) || -1) +1)
end
-end
+end if defined?(::User)
-page = Page.create(
- :title => "Blog",
- :link_url => "/blog",
- :deletable => false,
- :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
- :menu_match => "^/blogs?(\/|\/.+?|)$"
-)
+if defined?(::Page)
+ page = ::Page.create(
+ :title => "Blog",
+ :link_url => "/blog",
+ :deletable => false,
+ :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
+ :menu_match => "^/blogs?(\/|\/.+?|)$"
+ )
-Page.default_parts.each do |default_page_part|
- page.parts.create(:title => default_page_part, :body => nil)
-end
+ ::Page.default_parts.each do |default_page_part|
+ page.parts.create(:title => default_page_part, :body => nil)
+ end
+end \ No newline at end of file