Commit 8f6ac4c993c9ea0375b37ce7ca7e1c43d0da284a

Authored by MoisesMachado
1 parent 1def090d

ActionItem6: migration renamed

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@195 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/enterprise.rb
1 #A enterprise is a kind of profile. According to the system concept, only enterprises can offer priducts/services 1 #A enterprise is a kind of profile. According to the system concept, only enterprises can offer priducts/services
2 class Enterprise < Profile 2 class Enterprise < Profile
3 -  
4 end 3 end
app/models/user.rb
@@ -5,7 +5,7 @@ require &#39;digest/sha1&#39; @@ -5,7 +5,7 @@ require &#39;digest/sha1&#39;
5 class User < ActiveRecord::Base 5 class User < ActiveRecord::Base
6 6
7 after_create do |user| 7 after_create do |user|
8 - Profile.create!(:identifier => user.login, :profile_owner_id => user.id, :profile_owner_type => 'User') 8 + Person.create!(:identifier => user.login, :profile_owner_id => user.id, :profile_owner_type => 'User')
9 end 9 end
10 10
11 has_one :personal_profile, :class_name => 'Profile', :as => :profile_owner 11 has_one :personal_profile, :class_name => 'Profile', :as => :profile_owner
db/migrate/007_create_affiliations.rb 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +class CreateAffiliations < ActiveRecord::Migration
  2 + def self.up
  3 + create_table :affiliations do |t|
  4 + t.column :user_id, :integer
  5 + t.column :profile_id, :integer
  6 + end
  7 + end
  8 +
  9 + def self.down
  10 + drop_table :affiliations
  11 + end
  12 +end
db/migrate/008_create_affiliations.rb
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -class CreateAffiliations < ActiveRecord::Migration  
2 - def self.up  
3 - create_table :affiliations do |t|  
4 - t.column :user_id, :integer  
5 - t.column :profile_id, :integer  
6 - end  
7 - end  
8 -  
9 - def self.down  
10 - drop_table :affiliations  
11 - end  
12 -end  
db/migrate/008_create_people.rb 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +class CreatePeople < ActiveRecord::Migration
  2 + def self.up
  3 + create_table :people do |t|
  4 + end
  5 + end
  6 +
  7 + def self.down
  8 + drop_table :people
  9 + end
  10 +end
test/fixtures/enterprises.yml
1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 1 # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2 one: 2 one:
3 id: 1 3 id: 1
  4 + name: 'Enterprise 1'
  5 + manager_id: 1
  6 + active: false
4 two: 7 two:
5 id: 2 8 id: 2