diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 452f51c..bb28b86 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -12,9 +12,7 @@ class ApplicationController < ActionController::Base # Load the owner def load_owner # TODO: this should not be hardcoded - if Profile.exists?(1) - @owner = Profile.find(1) - end + @owner = Profile.find(1) if Profile.exists?(1) end protected @@ -30,10 +28,6 @@ class ApplicationController < ActionController::Base end end - def flexible_template_onwer - @virtual_community_admin || @profile - end - def self.acts_as_virtual_community_admin_controller before_filter :load_admin_controller end diff --git a/app/controllers/enterprise_controller.rb b/app/controllers/enterprise_controller.rb index b015a04..b93fe0c 100644 --- a/app/controllers/enterprise_controller.rb +++ b/app/controllers/enterprise_controller.rb @@ -1,6 +1,10 @@ # Manage enterprises by providing an interface to register, activate and manage them class EnterpriseController < ApplicationController + def index + @my_enterprises = current_user.enterprises + end + def register unless logged_in? redirect_to :controller => 'account' diff --git a/app/models/affiliation.rb b/app/models/affiliation.rb new file mode 100644 index 0000000..ffa99a3 --- /dev/null +++ b/app/models/affiliation.rb @@ -0,0 +1,4 @@ +class Affiliation < ActiveRecord::Base + belongs_to :user + belongs_to :enterprise +end diff --git a/db/migrate/007_create_enterprises.rb b/db/migrate/007_create_enterprises.rb index 9771197..03c9841 100644 --- a/db/migrate/007_create_enterprises.rb +++ b/db/migrate/007_create_enterprises.rb @@ -11,6 +11,7 @@ class CreateEnterprises < ActiveRecord::Migration t.column :economic_activity, :string t.column :management_information, :string t.column :active, :boolean, :default => "false" + t.column :manager_id, :integer end end diff --git a/db/migrate/008_create_affiliations.rb b/db/migrate/008_create_affiliations.rb new file mode 100644 index 0000000..8282383 --- /dev/null +++ b/db/migrate/008_create_affiliations.rb @@ -0,0 +1,12 @@ +class CreateAffiliations < ActiveRecord::Migration + def self.up + create_table :affiliations do |t| + t.column :user_id, :integer + t.column :enterprise_id, :integer + end + end + + def self.down + drop_table :affiliations + end +end diff --git a/test/fixtures/affiliations.yml b/test/fixtures/affiliations.yml new file mode 100644 index 0000000..b49c4eb --- /dev/null +++ b/test/fixtures/affiliations.yml @@ -0,0 +1,5 @@ +# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html +one: + id: 1 +two: + id: 2 diff --git a/test/unit/affiliation_test.rb b/test/unit/affiliation_test.rb new file mode 100644 index 0000000..c7013ff --- /dev/null +++ b/test/unit/affiliation_test.rb @@ -0,0 +1,10 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class AffiliationTest < Test::Unit::TestCase + fixtures :affiliations + + # Replace this with your real tests. + def test_truth + assert true + end +end -- libgit2 0.21.2