Skip to content

Commit

Permalink
fixed bug in create_root_page
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakjo committed Sep 22, 2009
1 parent fd0d6b5 commit 5884a4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion comatose.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated on Tue May 20 20:13:12 -0500 2008
Gem::Specification.new do |s|
s.name = "comatose"
s.version = "2.0.5.2"
s.version = "2.0.5.3"
s.date = "2008-10-31" # 2008-05-20
s.summary = "Micro CMS designed for being embedded into existing Rails applications"
s.email = "[email protected]"
Expand Down
20 changes: 12 additions & 8 deletions lib/comatose.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ def self.load_extensions
end
end

def self.create_root_page(options ={})
unless ComatosePage.root
page = ComatosePage.create({:title=>'root page', :body=>"Welcome to comatose", :author=>'System'}.merge(options), :parent_id=>nil)
page.save(false)
else
raise "There exists a comatose root page, cant create another one"
end
end

end

require 'acts_as_versioned'
Expand All @@ -39,3 +32,14 @@ def self.create_root_page(options ={})
::Dispatcher.to_prepare :comatose do
Comatose.config.after_setup.call
end

module Comatose
def self.create_root_page(options ={})
unless ComatosePage.root
page = ComatosePage.create({:title=>'root page', :body=>"Welcome to comatose", :author=>'System', :parent_id=>nil}.merge(options))
page.save(false)
else
raise "There exists a comatose root page, cant create another one"
end
end
end

0 comments on commit 5884a4c

Please sign in to comment.