Commit 343093b3074f8d9cfda42c564660a1776b244ba8

Authored by AntonioTerceiro
1 parent 9430f210

ActionItem41: using the settings module to implement a description field in Community class


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1319 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/community.rb
1 -class Community < Profile 1 +class Community < Organization
  2 +
  3 + settings_items :description
2 4
3 def name=(value) 5 def name=(value)
4 super(value) 6 super(value)
app/models/profile.rb
@@ -18,6 +18,8 @@ class Profile &lt; ActiveRecord::Base @@ -18,6 +18,8 @@ class Profile &lt; ActiveRecord::Base
18 18
19 acts_as_searchable :fields => [ :name, :identifier ] 19 acts_as_searchable :fields => [ :name, :identifier ]
20 20
  21 + acts_as_having_settings :field => :data
  22 +
21 # Valid identifiers must match this format. 23 # Valid identifiers must match this format.
22 IDENTIFIER_FORMAT = /^[a-z][a-z0-9]+([_-][a-z0-9]+)*$/ 24 IDENTIFIER_FORMAT = /^[a-z][a-z0-9]+([_-][a-z0-9]+)*$/
23 25
test/unit/community_test.rb
@@ -12,4 +12,10 @@ class CommunityTest &lt; Test::Unit::TestCase @@ -12,4 +12,10 @@ class CommunityTest &lt; Test::Unit::TestCase
12 assert_equal 'my-shiny-new-community', c.identifier 12 assert_equal 'my-shiny-new-community', c.identifier
13 end 13 end
14 14
  15 + should 'have a description attribute' do
  16 + c = Community.new
  17 + c.description = 'the description of the community'
  18 + assert_equal 'the description of the community', c.description
  19 + end
  20 +
15 end 21 end