Commit 27d39089de2f049b1b2ea279f67dfcb8ba3d3e60
1 parent
add53fc4
Exists in
master
and in
29 other branches
ActionItem3: better documentation for VirtualCommunity model
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@124 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
9 additions
and
3 deletions
Show diff stats
app/models/virtual_community.rb
1 | +# A VirtualCommunity is like a website to be hosted in the platform. It may | ||
2 | +# contain multiple Profile's and can be identified by several different | ||
3 | +# domains. | ||
1 | class VirtualCommunity < ActiveRecord::Base | 4 | class VirtualCommunity < ActiveRecord::Base |
2 | 5 | ||
3 | # returns the available features for a VirtualCommunity, in the form of a | 6 | # returns the available features for a VirtualCommunity, in the form of a |
@@ -20,22 +23,25 @@ class VirtualCommunity < ActiveRecord::Base | @@ -20,22 +23,25 @@ class VirtualCommunity < ActiveRecord::Base | ||
20 | # Attributes | 23 | # Attributes |
21 | # ################################################# | 24 | # ################################################# |
22 | 25 | ||
26 | + # store the VirtualCommunity settings as YAML-serialized Hash. | ||
23 | serialize :settings | 27 | serialize :settings |
28 | + | ||
29 | + # returns a Hash containing the VirtualCommunity configuration | ||
24 | def settings | 30 | def settings |
25 | self[:settings] ||= {} | 31 | self[:settings] ||= {} |
26 | end | 32 | end |
27 | 33 | ||
28 | - # Enables a feature | 34 | + # Enables a feature identified by its name |
29 | def enable(feature) | 35 | def enable(feature) |
30 | self.settings["#{feature}_enabled"] = true | 36 | self.settings["#{feature}_enabled"] = true |
31 | end | 37 | end |
32 | 38 | ||
33 | - # Disables a feature | 39 | + # Disables a feature identified by its name |
34 | def disable(feature) | 40 | def disable(feature) |
35 | self.settings["#{feature}_enabled"] = false | 41 | self.settings["#{feature}_enabled"] = false |
36 | end | 42 | end |
37 | 43 | ||
38 | - # Tells if a feature is enabled | 44 | + # Tells if a feature, identified by its name, is enabled |
39 | def enabled?(feature) | 45 | def enabled?(feature) |
40 | self.settings["#{feature}_enabled"] == true | 46 | self.settings["#{feature}_enabled"] == true |
41 | end | 47 | end |