From 343093b3074f8d9cfda42c564660a1776b244ba8 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Fri, 8 Feb 2008 23:36:15 +0000 Subject: [PATCH] ActionItem41: using the settings module to implement a description field in Community class --- app/models/community.rb | 4 +++- app/models/profile.rb | 2 ++ test/unit/community_test.rb | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/models/community.rb b/app/models/community.rb index ba6936c..421c214 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -1,4 +1,6 @@ -class Community < Profile +class Community < Organization + + settings_items :description def name=(value) super(value) diff --git a/app/models/profile.rb b/app/models/profile.rb index 927c002..6b8b621 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -18,6 +18,8 @@ class Profile < ActiveRecord::Base acts_as_searchable :fields => [ :name, :identifier ] + acts_as_having_settings :field => :data + # Valid identifiers must match this format. IDENTIFIER_FORMAT = /^[a-z][a-z0-9]+([_-][a-z0-9]+)*$/ diff --git a/test/unit/community_test.rb b/test/unit/community_test.rb index 987adaf..a493cd0 100644 --- a/test/unit/community_test.rb +++ b/test/unit/community_test.rb @@ -12,4 +12,10 @@ class CommunityTest < Test::Unit::TestCase assert_equal 'my-shiny-new-community', c.identifier end + should 'have a description attribute' do + c = Community.new + c.description = 'the description of the community' + assert_equal 'the description of the community', c.description + end + end -- libgit2 0.21.2