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?
|
if user.plugins.where(:name => 'refinerycms_blog').blank?
|
||||||
user.plugins.create(:name => "refinerycms_blog",
|
user.plugins.create(:name => "refinerycms_blog",
|
||||||
:position => (user.plugins.maximum(:position) || -1) +1)
|
:position => (user.plugins.maximum(:position) || -1) +1)
|
||||||
end
|
end
|
||||||
end
|
end if defined?(::User)
|
||||||
|
|
||||||
page = Page.create(
|
if defined?(::Page)
|
||||||
:title => "Blog",
|
page = ::Page.create(
|
||||||
:link_url => "/blog",
|
:title => "Blog",
|
||||||
:deletable => false,
|
:link_url => "/blog",
|
||||||
:position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
|
:deletable => false,
|
||||||
:menu_match => "^/blogs?(\/|\/.+?|)$"
|
:position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
|
||||||
)
|
:menu_match => "^/blogs?(\/|\/.+?|)$"
|
||||||
|
)
|
||||||
|
|
||||||
Page.default_parts.each do |default_page_part|
|
::Page.default_parts.each do |default_page_part|
|
||||||
page.parts.create(:title => default_page_part, :body => nil)
|
page.parts.create(:title => default_page_part, :body => nil)
|
||||||
end
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue