Commit 66771e831aa64bf1a9ac11fe32d207f0a1977b54
1 parent
bc8bfd74
Exists in
master
and in
29 other branches
ActionItem6: Enterprise controller updated
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@202 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
5 changed files
with
6 additions
and
5 deletions
Show diff stats
app/controllers/enterprise_controller.rb
... | ... | @@ -4,7 +4,7 @@ class EnterpriseController < ApplicationController |
4 | 4 | before_filter :logon |
5 | 5 | |
6 | 6 | def index |
7 | - @my_enterprises = current_user.profiles.select{|p| p.kind_of?(Enterprise)} | |
7 | + @my_enterprises = current_user.person.profiles.select{|p| p.kind_of?(Enterprise)} | |
8 | 8 | @enterprises = Enterprise.find(:all) - @my_enterprises |
9 | 9 | end |
10 | 10 | |
... | ... | @@ -15,9 +15,8 @@ class EnterpriseController < ApplicationController |
15 | 15 | |
16 | 16 | def register |
17 | 17 | @enterprise = Enterprise.new(params[:enterprise]) |
18 | - @enterprise.manager_id = current_user.id | |
19 | 18 | if @enterprise.save |
20 | - @enterprise.users << current_user | |
19 | + @enterprise.people << current_user.person | |
21 | 20 | flash[:notice] = _('Enterprise was succesfully created') |
22 | 21 | redirect_to :action => 'index' |
23 | 22 | else | ... | ... |
app/models/profile.rb
... | ... | @@ -18,7 +18,7 @@ class Profile < ActiveRecord::Base |
18 | 18 | ] |
19 | 19 | |
20 | 20 | has_many :affiliations |
21 | - has_many :users, :through => :affiliations | |
21 | + has_many :people, :through => :affiliations | |
22 | 22 | has_many :domains, :as => :owner |
23 | 23 | belongs_to :virtual_community |
24 | 24 | belongs_to :profile_owner, :polymorphic => true | ... | ... |
app/models/user.rb
lib/extended_tag.rb