Class: Joey::Page
Instance Attribute Summary
Attributes inherited from Model
#client, #errors
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Profile
#to_s
Methods inherited from Model
define_properties, find, has_association, hash_populating_accessor, #initialize
Constructor Details
This class inherits a constructor from Joey::Model
Class Method Details
.recognize?(hash) ⇒ Boolean
15
16
17
|
# File 'lib/joey/page.rb', line 15
def self.recognize?(hash)
hash.has_key?("category")
end
|
Instance Method Details
#valid? ⇒ Boolean
25
26
27
28
|
# File 'lib/joey/page.rb', line 25
def valid?
self.validate
self.errors.empty?
end
|
#validate ⇒ Object
19
20
21
22
23
|
# File 'lib/joey/page.rb', line 19
def validate
valid = true
errors << { :message => 'id should not be nil' } if id.nil?
errors << { :message => "name should be string but is #{name.inspect}" } unless name.is_a?(String)
end
|