diff options
author | Philip Arndt <git@p.arndt.io> | 2016-03-31 16:43:44 +1300 |
---|---|---|
committer | Philip Arndt <git@p.arndt.io> | 2016-03-31 16:43:44 +1300 |
commit | dce7da10f8151a9e1ebc3f2cacfb80d207048313 (patch) | |
tree | cf0b6066776d6381f1695580e5fd4380d6ef1d4e | |
parent | 8d052c50e20da74a17b284225f69b5d4c1beb52e (diff) | |
download | refinerycms-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.rb | 8 |
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 |