<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -6,7 +6,7 @@ module Goldberg
   class ContentPage &lt; ActiveRecord::Base
     include Goldberg::Model
 
-    belongs_to :permission
+    belongs_to :permission, :class_name =&gt; 'Goldberg::Permission'
     validates_presence_of :name, :title, :permission_id
     validates_uniqueness_of :name
     attr_accessor :content_html</diff>
      <filename>app/models/goldberg/content_page.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,8 +2,8 @@ module Goldberg
   class ControllerAction &lt; ActiveRecord::Base
     include Goldberg::Model
     
-    belongs_to :site_controller
-    belongs_to :permission
+    belongs_to :site_controller, :class_name =&gt; 'Goldberg::SiteController'
+    belongs_to :permission, :class_name =&gt; 'Goldberg::Permission'
     
     validates_presence_of :name, :site_controller_id
     validates_uniqueness_of :name, :scope =&gt; 'site_controller_id'</diff>
      <filename>app/models/goldberg/controller_action.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,9 +2,9 @@ module Goldberg
   class Permission &lt; ActiveRecord::Base
     include Goldberg::Model
 
-    has_many :content_pages
-    has_many :site_controllers
-    has_many :controller_actions
+    has_many :content_pages, :class_name =&gt; 'Goldberg::ContentPage'
+    has_many :site_controllers, :class_name =&gt; 'Goldberg::SiteController'
+    has_many :controller_actions, :class_name =&gt; 'Goldberg::ControllerAction'
     
     validates_presence_of :name
     validates_uniqueness_of :name</diff>
      <filename>app/models/goldberg/permission.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,7 @@ module Goldberg
   class Role &lt; ActiveRecord::Base
     include Goldberg::Model
 
-    has_many :users
+    has_many :users, :class_name =&gt; 'Goldberg::User'
     
     validates_presence_of :name
     validates_uniqueness_of :name</diff>
      <filename>app/models/goldberg/role.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,8 +2,9 @@ module Goldberg
   class SiteController &lt; ActiveRecord::Base
     include Goldberg::Model
 
-    belongs_to :permission
-    has_many :controller_actions, :order =&gt; 'name', :dependent =&gt; :destroy
+    belongs_to :permission, :class_name =&gt; 'Goldberg::Permission'
+    has_many :controller_actions, :class_name =&gt; 'Goldberg::ControllerAction', :order =&gt; 'name',
+    :dependent =&gt; :destroy
     
     validates_presence_of :name, :permission_id
     validates_uniqueness_of :name</diff>
      <filename>app/models/goldberg/site_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ module Goldberg
   class User &lt; ActiveRecord::Base
     include Goldberg::Model
 
-    belongs_to :role
+    belongs_to :role, :class_name =&gt; 'Goldberg::Role'
     
     validates_presence_of :name, :role_id, :password
     validates_uniqueness_of :name</diff>
      <filename>app/models/goldberg/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,5 @@
+require 'rails_generator'
+
 # Set load paths to include the plugin /app directory
 controller_path = &quot;#{File.dirname(__FILE__)}/app/controllers&quot;
 model_path      = &quot;#{File.dirname(__FILE__)}/app/models&quot;</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,9 +2,8 @@ module Goldberg
   module Controller
     def self.included(base)
       base.class_eval do
-        base.view_paths =
-          [&quot;#{RAILS_ROOT}/vendor/plugins/goldberg/app/views&quot;]
-        base.layout &quot;../../../../../app/views/layouts/application&quot;
+        base.append_view_path([&quot;#{RAILS_ROOT}/vendor/plugins/goldberg/app/views&quot;])
+        base.layout &quot;application&quot;
       end
     end
   end</diff>
      <filename>lib/goldberg/controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,14 +14,14 @@ module Goldberg
   module SchemaStatements
     def self.included(base) #:nodoc:
       base.class_eval do
-        alias_method_chain :initialize_schema_information, :plugins
+        alias_method_chain :initialize_schema_migrations_table, :plugins
         alias_method_chain :dump_schema_information, :plugins
       end
     end
     
     # Creates the plugin schema info table
-    def initialize_schema_information_with_plugins
-      initialize_schema_information_without_plugins
+    def initialize_schema_migrations_table_with_plugins
+      initialize_schema_migrations_table_without_plugins
       
       begin
         execute &lt;&lt;-EOS</diff>
      <filename>lib/goldberg/migrator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,40 @@ namespace :goldberg do
   task :upgrade =&gt; :migrate do
   end
   
+  desc &quot;Apply a site theme&quot;
+  task :theme, :theme_name, :needs =&gt; :environment do |t, args|
+    source_dir = File.join(File.dirname(__FILE__), '..', 'themes')
+    theme = args.theme_name || 'goldberg'
+    theme_dir = File.join(source_dir, theme)
+    if File.directory?(theme_dir)
+      manifest = Rails::Generator::Manifest.new do |m|
+        # Public assets: images, javascripts and stylesheets, including both the
+        # common files and files specific to the specified theme.
+        ['images', 'javascripts', 'stylesheets'].each do |asset|
+          dest_dir = File.join('public/goldberg', asset)
+          m.directory dest_dir
+          ['common', theme].each do |src|
+            Dir[&quot;#{source_dir}/#{src}/public/#{asset}/*&quot;].each do |file_path|
+              file = File.basename(file_path)
+              m.file &quot;#{src}/public/#{asset}/#{file}&quot;, &quot;#{dest_dir}/#{file}&quot;
+            end
+          end
+        end
+        # The default site template
+        m.file &quot;#{theme}/app/views/layouts/application.html.erb&quot;,
+        &quot;app/views/layouts/application.html.erb&quot;
+      end
+      # Run the manifest created above through Rails::Generator
+      Rails::Generator::Base.spec = Rails::Generator::Spec.new('', '', nil)
+      base = Rails::Generator::Base.new([], :source =&gt; source_dir)
+      commands = Rails::Generator::Commands::Create.new(base)
+      manifest.replay(commands)
+    else  # theme directory doesn't exist
+      raise ArgumentError.new,
+      &quot;No such theme '#{theme}'&quot;
+    end
+  end
+  
   desc &quot;Flush cached data out of sessions and Roles&quot;
   task :flush =&gt; :environment do
     puts &quot;Deleting any Rails session files&quot;</diff>
      <filename>tasks/goldberg_tasks.rake</filename>
    </modified>
    <modified>
      <diff>@@ -21,42 +21,8 @@ class SecurityTest &lt; ActionController::IntegrationTest
 
     get '/goldberg/users/list'
     assert_response :success
-
-    form_logout
-
-    get '/goldberg/users/list'
-    assert_redirected_to_login
   end
 
-  # When a user with insufficient rights tries to access a page or
-  # action they don't get redirected to login: they get redirected to
-  # the &quot;denied&quot; page.
-  def test_insufficient_security
-    old_count = Goldberg::User.count
-    form_login('admin', 'admin')
-    post '/goldberg/users/create', :user =&gt; {
-      :name =&gt; 'fred',
-      :fullname =&gt; 'Fred Bloggs',
-      :role_id =&gt; '2',  # &quot;Member&quot;
-      :clear_password =&gt; 'fred',
-      :confirm_password =&gt; 'fred',
-    }
-    # User was created OK
-    assert_equal (old_count + 1), Goldberg::User.count
-
-    # Logout, then login as new user
-    form_logout
-    form_login('fred', 'fred')
-    assert_not_nil session[:goldberg][:user_id]
-
-    # An administrator action: denied
-    get '/goldberg/users/list'
-    assert_redirected_to :permission_denied_page
-    # An administrator page: denied
-    get '/admin'
-    assert_redirected_to :permission_denied_page
-  end
-  
   # Public user can view public pages, but when they try accessing an
   # administrator page they are redirected to login.
   def test_page_security
@@ -71,11 +37,6 @@ class SecurityTest &lt; ActionController::IntegrationTest
     
     get '/admin'
     assert_response :success
-
-    form_logout
-
-    get '/admin'
-    assert_redirected_to_login
   end
 
   # If a public user tries to access a resource for which they lack</diff>
      <filename>test/integration/security_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c9fb7d048f93de6df722c76f0a51b95b0a797d1e</id>
    </parent>
  </parents>
  <author>
    <name>Dave Nelson</name>
    <email>urbanus@240gl.org</email>
  </author>
  <url>http://github.com/urbanus/goldberg/commit/55f557b53c795d4b4768c474f1d1d5b78eda1558</url>
  <id>55f557b53c795d4b4768c474f1d1d5b78eda1558</id>
  <committed-date>2008-07-09T03:41:16-07:00</committed-date>
  <authored-date>2008-07-09T03:41:16-07:00</authored-date>
  <message>More Rails 2.1 compatibility changes.</message>
  <tree>836e137dcf13fe33188369fa81404a65c471ae52</tree>
  <committer>
    <name>Dave Nelson</name>
    <email>urbanus@240gl.org</email>
  </committer>
</commit>
