aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Arndt <git@p.arndt.io>2016-03-31 16:43:44 +1300
committerPhilip Arndt <git@p.arndt.io>2016-03-31 16:43:44 +1300
commitdce7da10f8151a9e1ebc3f2cacfb80d207048313 (patch)
treecf0b6066776d6381f1695580e5fd4380d6ef1d4e
parent8d052c50e20da74a17b284225f69b5d4c1beb52e (diff)
downloadrefinerycms-blog-dce7da10f8151a9e1ebc3f2cacfb80d207048313.tar.gz
refinerycms-blog-dce7da10f8151a9e1ebc3f2cacfb80d207048313.tar.bz2
refinerycms-blog-dce7da10f8151a9e1ebc3f2cacfb80d207048313.zip
Allow author to be optional by overriding author_required?
-rw-r--r--app/models/refinery/blog/post.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb
index d05cb14..9e69162 100644
--- a/app/models/refinery/blog/post.rb
+++ b/app/models/refinery/blog/post.rb
@@ -21,7 +21,8 @@ module Refinery
validates :title, :presence => true, :uniqueness => true
validates :body, :presence => true
- validates :published_at, :author, :presence => true
+ validates :published_at, :presence => true
+ validates :author, :presence => true, if: :author_required?
validates :source_url, :url => { :if => 'Refinery::Blog.validate_source_url',
:update => true,
:allow_nil => true,
@@ -31,6 +32,11 @@ module Refinery
class Translation
is_seo_meta
end
+
+ # Override this to disable required authors
+ def author_required?
+ true
+ end
# If custom_url or title changes tell friendly_id to regenerate slug when
# saving record