Refactor "unless blank?" into "if present?"

This commit is contained in:
Mindaugas Mozūras 2013-09-13 15:40:09 +03:00
parent 4ca6114b76
commit 25e764b21a
15 changed files with 27 additions and 27 deletions

View file

@ -49,7 +49,7 @@ module IsTaggable
def _add_tags incoming
tag_cast_to_string(incoming).each do |tag_name|
# added following check to prevent empty tags from being saved (which will fail)
unless tag_name.blank?
if tag_name.present?
begin
tag = Tag.where(:name => tag_name).first_or_create
raise Tag::Error, "tag could not be saved: #{tag_name}" if tag.new_record?