Permalink
Browse files

Fixes Captcha Settings preferences

  • Loading branch information...
1 parent 89d2eaf commit bbc7b0b9ac4632f3d8432b0d8b19798b3c1260f4 @LBRapid LBRapid committed Dec 6, 2011
Showing with 8 additions and 17 deletions.
  1. +1 −1 app/models/spree/captcha_configuration.rb
  2. +0 −15 lib/spree/captcha/config.rb
  3. +7 −1 lib/spree_email_to_friend/engine.rb
@@ -1,4 +1,4 @@
-class Spree::CaptchaConfiguration < Spree::Configuration
+class Spree::CaptchaConfiguration < Spree::Preferences::Configuration
THEMES = ['red', 'white', 'blackglass', 'clean', 'custom']
# this keys works for localhost
@@ -1,15 +0,0 @@
-module Spree
- module Captcha
- class Config
- include Singleton
- include PreferenceAccess
-
- class << self
- def instance
- return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
- Spree::CaptchaConfiguration.find_or_create_by_name('Captcha configuration')
- end
- end
- end
- end
-end
@@ -1,11 +1,18 @@
require 'recaptcha/rails'
+module Spree::Captcha
+end
+
module SpreeEmailToFriend
class Engine < Rails::Engine
engine_name 'spree_email_to_friend'
config.autoload_paths += %W(#{config.root}/lib)
+ initializer "spree.email_to_friend.preferences", :after => "spree.environment" do |app|
+ Spree::Captcha::Config = Spree::CaptchaConfiguration.new
+ end
+
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
Rails.application.config.cache_classes ? require(c) : load(c)
@@ -14,7 +21,6 @@ def self.activate
#Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
# Rails.application.config.cache_classes ? require(c) : load(c)
#end
- Spree::CaptchaConfiguration.find_or_create_by_name("Default spree_captcha configuration")
end
config.to_prepare &method(:activate).to_proc

0 comments on commit bbc7b0b

Please sign in to comment.