Commit 241766d6b308bb9afa1ab68087db81e08bfd9e33
1 parent
f271ac23
Exists in
master
and in
28 other branches
ActionItem9: refactoring: removing acts_as_configurable and using a plain Hash
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@107 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
7 additions
and
6 deletions
Show diff stats
app/models/virtual_community.rb
@@ -16,12 +16,14 @@ class VirtualCommunity < ActiveRecord::Base | @@ -16,12 +16,14 @@ class VirtualCommunity < ActiveRecord::Base | ||
16 | # One VirtualCommunity can be reached by many domains | 16 | # One VirtualCommunity can be reached by many domains |
17 | has_many :domains, :as => :owner | 17 | has_many :domains, :as => :owner |
18 | 18 | ||
19 | - # a VirtualCommunity can be configured | ||
20 | - acts_as_configurable | ||
21 | - | ||
22 | # ################################################# | 19 | # ################################################# |
23 | # Attributes | 20 | # Attributes |
24 | # ################################################# | 21 | # ################################################# |
22 | + | ||
23 | + serialize :settings | ||
24 | + def settings | ||
25 | + self[:settings] ||= {} | ||
26 | + end | ||
25 | 27 | ||
26 | # Enables a feature | 28 | # Enables a feature |
27 | def enable(feature) | 29 | def enable(feature) |
db/migrate/001_create_virtual_communities.rb
1 | class CreateVirtualCommunities < ActiveRecord::Migration | 1 | class CreateVirtualCommunities < ActiveRecord::Migration |
2 | def self.up | 2 | def self.up |
3 | create_table :virtual_communities do |t| | 3 | create_table :virtual_communities do |t| |
4 | - t.column :name, :string | 4 | + t.column :name, :string |
5 | t.column :is_default, :boolean | 5 | t.column :is_default, :boolean |
6 | + t.column :settings, :text | ||
6 | end | 7 | end |
7 | VirtualCommunity.create(:name => 'Default Virtual Community', :is_default => true) | 8 | VirtualCommunity.create(:name => 'Default Virtual Community', :is_default => true) |
8 | - ConfigurableSetting.create_table | ||
9 | end | 9 | end |
10 | 10 | ||
11 | def self.down | 11 | def self.down |
12 | - ConfigurableSetting.drop_table | ||
13 | drop_table :virtual_communities | 12 | drop_table :virtual_communities |
14 | end | 13 | end |
15 | end | 14 | end |