diff --git a/app/controllers/enterprise_controller.rb b/app/controllers/enterprise_controller.rb index d148afd..c53c97e 100644 --- a/app/controllers/enterprise_controller.rb +++ b/app/controllers/enterprise_controller.rb @@ -4,7 +4,7 @@ class EnterpriseController < ApplicationController before_filter :logon def index - @my_enterprises = current_user.profiles.select{|p| p.kind_of?(Enterprise)} + @my_enterprises = current_user.person.profiles.select{|p| p.kind_of?(Enterprise)} @enterprises = Enterprise.find(:all) - @my_enterprises end @@ -15,9 +15,8 @@ class EnterpriseController < ApplicationController def register @enterprise = Enterprise.new(params[:enterprise]) - @enterprise.manager_id = current_user.id if @enterprise.save - @enterprise.users << current_user + @enterprise.people << current_user.person flash[:notice] = _('Enterprise was succesfully created') redirect_to :action => 'index' else diff --git a/app/models/profile.rb b/app/models/profile.rb index b7f7df8..1b0feaf 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -18,7 +18,7 @@ class Profile < ActiveRecord::Base ] has_many :affiliations - has_many :users, :through => :affiliations + has_many :people, :through => :affiliations has_many :domains, :as => :owner belongs_to :virtual_community belongs_to :profile_owner, :polymorphic => true diff --git a/app/models/user.rb b/app/models/user.rb index 15f60c0..bcf450e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -9,6 +9,7 @@ class User < ActiveRecord::Base end has_one :person + # Virtual attribute for the unencrypted password attr_accessor :password diff --git a/lib/extended_tag.rb b/lib/extended_tag.rb index c15b0ab..8078135 100644 --- a/lib/extended_tag.rb +++ b/lib/extended_tag.rb @@ -13,7 +13,7 @@ class Tag end end -# acts_as_ferret :fields => [:name] + acts_as_ferret :fields => [:name] # Return all the tags that were suggested but not yet approved diff --git a/test/fixtures/profiles.yml b/test/fixtures/profiles.yml index 046ca6b..4bd77a7 100644 --- a/test/fixtures/profiles.yml +++ b/test/fixtures/profiles.yml @@ -32,6 +32,7 @@ ze: id: 4 name: "Zé" type: 'Person' + user_id: 3 identifier: ze virtual_community_id: 1 flexible_template_template: 'default' -- libgit2 0.21.2