Commit 27d39089de2f049b1b2ea279f67dfcb8ba3d3e60
1 parent
add53fc4
Exists in
staging
and in
42 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 | 4 | class VirtualCommunity < ActiveRecord::Base |
| 2 | 5 | |
| 3 | 6 | # returns the available features for a VirtualCommunity, in the form of a |
| ... | ... | @@ -20,22 +23,25 @@ class VirtualCommunity < ActiveRecord::Base |
| 20 | 23 | # Attributes |
| 21 | 24 | # ################################################# |
| 22 | 25 | |
| 26 | + # store the VirtualCommunity settings as YAML-serialized Hash. | |
| 23 | 27 | serialize :settings |
| 28 | + | |
| 29 | + # returns a Hash containing the VirtualCommunity configuration | |
| 24 | 30 | def settings |
| 25 | 31 | self[:settings] ||= {} |
| 26 | 32 | end |
| 27 | 33 | |
| 28 | - # Enables a feature | |
| 34 | + # Enables a feature identified by its name | |
| 29 | 35 | def enable(feature) |
| 30 | 36 | self.settings["#{feature}_enabled"] = true |
| 31 | 37 | end |
| 32 | 38 | |
| 33 | - # Disables a feature | |
| 39 | + # Disables a feature identified by its name | |
| 34 | 40 | def disable(feature) |
| 35 | 41 | self.settings["#{feature}_enabled"] = false |
| 36 | 42 | end |
| 37 | 43 | |
| 38 | - # Tells if a feature is enabled | |
| 44 | + # Tells if a feature, identified by its name, is enabled | |
| 39 | 45 | def enabled?(feature) |
| 40 | 46 | self.settings["#{feature}_enabled"] == true |
| 41 | 47 | end | ... | ... |