Class: Joey::Comment
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
Methods inherited from Model
define_properties, find, has_association, hash_populating_accessor, #initialize, recognize?
Constructor Details
This class inherits a constructor from Joey::Model
Instance Method Details
#valid? ⇒ Boolean
14 15 16 17 |
# File 'lib/joey/comment.rb', line 14 def valid? self.validate self.errors.empty? end |
#validate ⇒ Object
7 8 9 10 11 12 |
# File 'lib/joey/comment.rb', line 7 def validate created_time.to_time rescue errors << { :message => 'created_time is not compatible' } updated_time.to_time rescue errors << { :message => 'updated_time is not compatible' } errors << { :message => 'id should not be nil' } if id.nil? errors << { :message => 'from is not a Joey::User or Joey::Page' } unless from.is_a?(Joey::User) || from.is_a?(Joey::Page) end |