Fix up the default body thing
This commit is contained in:
parent
925c7fff8d
commit
d872805101
@ -8,7 +8,7 @@ module Models
|
||||
included do
|
||||
before_validation do |p|
|
||||
if p.parts.empty?
|
||||
p.parts << PagePart.build_body_part(p.try(:body))
|
||||
p.parts << PagePart.build_body_part(p.respond_to?(:body) ? p.body : nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -15,6 +15,9 @@ class Page
|
||||
field :published, :type => Boolean, :default => false
|
||||
field :cache_strategy, :default => 'none'
|
||||
|
||||
# allows newly pages to have a default body
|
||||
attr_accessor :body
|
||||
|
||||
## associations ##
|
||||
referenced_in :site
|
||||
referenced_in :layout
|
||||
|
@ -354,7 +354,7 @@ describe Page do
|
||||
end
|
||||
|
||||
it "should render the passed in body attribute of the page" do
|
||||
@page.render(Liquid::Context.new).should == "PageBody"
|
||||
@page.render(Liquid::Context.new).should == "Page Body"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user