Ensure that the seeds don't blow up when either 'User' or 'Page' are not defined.
This commit is contained in:
parent
1f72e3d90a
commit
03e105b9e0
1 changed files with 14 additions and 12 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue