Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
fixed a couple of installation bugs...
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Adams committed Feb 9, 2009
1 parent 72db033 commit e068bd3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions db/migrate/20081123161548_add_status_to_pages.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class AddStatusToPages < ActiveRecord::Migration
def self.up
add_index :pages, :status
#add_index :pages, :status
# TODO: This needs to be moved to an 'initial setup' rake task
Page.create(
:name => 'home',
Expand All @@ -19,6 +19,6 @@ def self.up
end

def self.down
remove_index :pages, :column => :status
#remove_index :pages, :column => :status
end
end
38 changes: 20 additions & 18 deletions vendor/plugins/has_settings/lib/has_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,30 @@ module ClassMethods
# >> w.reload
# >> w.settings["foo"] #=> "bar
def has_settings
has_one :has_settings_setting, :as => "configurable"
after_save :save_settings
if ActiveRecord::Base.connection.table_exists?('has_settings_settings')
has_one :has_settings_setting, :as => "configurable"
after_save :save_settings

define_method "settings" do |*args|
@the_has_settings_setting ||= get_has_settings_setting
@the_has_settings_setting.settings || {}
end
define_method "settings" do |*args|
@the_has_settings_setting ||= get_has_settings_setting
@the_has_settings_setting.settings || {}
end

define_method "settings=" do |the_settings|
self.has_settings_setting.settings = the_settings
end
define_method "settings=" do |the_settings|
self.has_settings_setting.settings = the_settings
end

define_method "save_settings" do
get_has_settings_setting.save unless new_record?
end
define_method "save_settings" do
get_has_settings_setting.save unless new_record?
end

define_method "get_has_settings_setting" do
if self.has_settings_setting
self.has_settings_setting
else
self.has_settings_setting = HasSettingsSetting.new :settings => {}
self.has_settings_setting
define_method "get_has_settings_setting" do
if self.has_settings_setting
self.has_settings_setting
else
self.has_settings_setting = HasSettingsSetting.new :settings => {}
self.has_settings_setting
end
end
end
end
Expand Down

0 comments on commit e068bd3

Please sign in to comment.