Fix up the default body thing
This commit is contained in:
parent
925c7fff8d
commit
d872805101
|
@ -8,7 +8,7 @@ module Models
|
||||||
included do
|
included do
|
||||||
before_validation do |p|
|
before_validation do |p|
|
||||||
if p.parts.empty?
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,9 @@ class Page
|
||||||
field :published, :type => Boolean, :default => false
|
field :published, :type => Boolean, :default => false
|
||||||
field :cache_strategy, :default => 'none'
|
field :cache_strategy, :default => 'none'
|
||||||
|
|
||||||
|
# allows newly pages to have a default body
|
||||||
|
attr_accessor :body
|
||||||
|
|
||||||
## associations ##
|
## associations ##
|
||||||
referenced_in :site
|
referenced_in :site
|
||||||
referenced_in :layout
|
referenced_in :layout
|
||||||
|
|
Loading…
Reference in New Issue