Commit 72c560f6c0af0860388fd9e808c577ed90716401
1 parent
d8b52907
Exists in
master
and in
28 other branches
ActionItem6: enterprise model updated
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@178 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
3 additions
and
9 deletions
Show diff stats
app/models/enterprise.rb
... | ... | @@ -2,17 +2,10 @@ |
2 | 2 | class Enterprise < ActiveRecord::Base |
3 | 3 | |
4 | 4 | after_create do |enterprise| |
5 | - enterprise_profile = Profile.create(:identifier => enterprise.name) | |
5 | + Profile.create!(:identifier => enterprise.name, :profile_owner_id => enterprise.id, :profile_owner_type => 'Enterprise') | |
6 | 6 | end |
7 | 7 | |
8 | 8 | has_one :enterprise_profile, :class_name => 'Profile', :as => :profile_owner |
9 | 9 | |
10 | - def name=(a_name) | |
11 | - enterprise_profile.name = a_name | |
12 | - end | |
13 | - | |
14 | - def name | |
15 | - enterprise_profile.name | |
16 | - end | |
17 | - | |
10 | + validates_presence_of :name | |
18 | 11 | end | ... | ... |
db/migrate/007_create_enterprises.rb