Fixing method signature semantics

This commit is contained in:
Gonzalo Rodriguez 2011-09-03 03:36:38 -03:00
parent 0aeab944bf
commit 8dd05a5e5b
2 changed files with 3 additions and 3 deletions

View file

@ -128,7 +128,7 @@ class PhotosController < ApplicationController
format.html do
flash[:notice] = I18n.t 'photos.destroy.notice'
if photo.status_message_guid
if photo.status_message.message_or_photos_present?
if photo.status_message.text_and_photos_blank?
photo.status_message.destroy
respond_with photo, :location => person_photos_path(current_user.person)
else

View file

@ -136,14 +136,14 @@ class StatusMessage < Post
formatted_message(:plain_text => true)
end
def message_or_photos_present?
def text_and_photos_blank?
self.text.blank? && self.photos == []
end
protected
def ensure_message_requirements
if message_or_photos_present?
if text_and_photos_blank?
errors[:base] << 'Status message requires a message or at least one photo'
end
end