profile.rb
414 Bytes
require_dependency 'profile'
class Profile
def attr_to_hash
attrs = {
"type" => self.type,
"data" => {
"id" => self.id,
"identifier" => self.identifier,
"name" => self.name,
"description" => self.description
}
}
attrs['articles'] = []
self.articles.each do |article|
attrs['articles'] << article.attr_to_hash
end
attrs
end
end