Minor changes on status message
This commit is contained in:
parent
8dd05a5e5b
commit
2afb646286
1 changed files with 3 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ class StatusMessage < Post
|
||||||
xml_attr :raw_message
|
xml_attr :raw_message
|
||||||
|
|
||||||
has_many :photos, :dependent => :destroy, :foreign_key => :status_message_guid, :primary_key => :guid
|
has_many :photos, :dependent => :destroy, :foreign_key => :status_message_guid, :primary_key => :guid
|
||||||
validate :ensure_message_requirements
|
validate :presence_of_content
|
||||||
|
|
||||||
attr_accessible :text
|
attr_accessible :text
|
||||||
serialize :youtube_titles, Hash
|
serialize :youtube_titles, Hash
|
||||||
|
|
@ -137,12 +137,12 @@ class StatusMessage < Post
|
||||||
end
|
end
|
||||||
|
|
||||||
def text_and_photos_blank?
|
def text_and_photos_blank?
|
||||||
self.text.blank? && self.photos == []
|
self.text.blank? && self.photos.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def ensure_message_requirements
|
def presence_of_content
|
||||||
if text_and_photos_blank?
|
if text_and_photos_blank?
|
||||||
errors[:base] << 'Status message requires a message or at least one photo'
|
errors[:base] << 'Status message requires a message or at least one photo'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue