README.md in tram-policy-0.2.5 vs README.md in tram-policy-0.3.0
- old
+ new
@@ -40,10 +40,13 @@
option :text, proc(&:to_s), default: -> { article.text }
# define what methods and in what order we should use to validate an article
validate :title_presence
validate :subtitle_presence
- validate { errors.add :empty, field: "text", level: "error" if text.empty? }
+ validate do # use anonymous lambda
+ return unless text.empty?
+ errors.add :empty, field: "text", level: "error"
+ end
private
def title_presence
return unless title.empty?