Permalink
Browse files

Change gemspec dependency from activesupport to activerecord (which d…

…epends on activesupport (and activemodel))

Signed-off-by: Ben Johnson <bjohnson@binarylogic.com>
  • Loading branch information...
1 parent f0c9733 commit f8cd29c3d73fd486c606119672a35f2c71a3079e @m4n m4n committed with Sep 9, 2009
View
@@ -19,7 +19,7 @@ end
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
- test.libs << 'lib' << 'test'
+ test.libs << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end
View
@@ -196,11 +196,11 @@ Gem::Specification.new do |s|
s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<activesupport>, [">= 0"])
+ s.add_runtime_dependency(%q<activerecord>, [">= 2.2.1"])
else
- s.add_dependency(%q<activesupport>, [">= 0"])
+ s.add_dependency(%q<activerecord>, [">= 2.2.1"])
end
else
- s.add_dependency(%q<activesupport>, [">= 0"])
+ s.add_dependency(%q<activerecord>, [">= 2.2.1"])
end
end
View
@@ -1,4 +1,4 @@
-require "active_support"
+require "active_record"
require File.dirname(__FILE__) + "/authlogic/i18n"
require File.dirname(__FILE__) + "/authlogic/random"
@@ -53,4 +53,4 @@
require File.dirname(__FILE__) + "/authlogic/session/timeout"
require File.dirname(__FILE__) + "/authlogic/session/unauthorized_record"
require File.dirname(__FILE__) + "/authlogic/session/validation"
-require File.dirname(__FILE__) + "/authlogic/session/base"
+require File.dirname(__FILE__) + "/authlogic/session/base"
@@ -92,21 +92,16 @@ def first_column_to_exist(*columns_to_check)
end
end
-if defined?(::ActiveRecord)
- module ::ActiveRecord
- class Base
- include Authlogic::ActsAsAuthentic::Base
- include Authlogic::ActsAsAuthentic::Email
- include Authlogic::ActsAsAuthentic::LoggedInStatus
- include Authlogic::ActsAsAuthentic::Login
- include Authlogic::ActsAsAuthentic::MagicColumns
- include Authlogic::ActsAsAuthentic::Password
- include Authlogic::ActsAsAuthentic::PerishableToken
- include Authlogic::ActsAsAuthentic::PersistenceToken
- include Authlogic::ActsAsAuthentic::RestfulAuthentication
- include Authlogic::ActsAsAuthentic::SessionMaintenance
- include Authlogic::ActsAsAuthentic::SingleAccessToken
- include Authlogic::ActsAsAuthentic::ValidationsScope
- end
- end
-end
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Base
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Email
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::LoggedInStatus
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Login
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::MagicColumns
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Password
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::PerishableToken
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::PersistenceToken
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::RestfulAuthentication
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::SessionMaintenance
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::SingleAccessToken
+::ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::ValidationsScope
+
@@ -33,14 +33,14 @@ def self_and_descendents_from_active_record
[self]
end
- # For rails >2.3, fix mispelling
+ # For rails >= 2.3, mispelling fixed
def self_and_descendants_from_active_record
[self]
end
- # For rails >3.0
+ # For rails >= 3.0
def model_name
- clazz = defined?(ActiveModel) ? ActiveModel::Name : ActiveSupport::ModelName
+ clazz = defined?(::ActiveModel) ? ::ActiveModel::Name : ::ActiveSupport::ModelName
clazz.new(self.to_s)
end
end
@@ -53,4 +53,4 @@ def new_record?
end
end
end
-end
+end
@@ -13,10 +13,12 @@ module Validation
# errors.add(:base, "You must be awesome to log in") unless attempted_record.awesome?
# end
# end
- class Errors < ::ActiveRecord::Errors
- def [](key)
- value = super
- value.is_a?(Array) ? value : [value].compact
+ class Errors < (defined?(::ActiveModel) ? ::ActiveModel::Errors : ::ActiveRecord::Errors)
+ unless defined?(::ActiveModel)
+ def [](key)
+ value = super
+ value.is_a?(Array) ? value : [value].compact
+ end
end
end
@@ -77,4 +79,4 @@ def ensure_authentication_attempted
end
end
end
-end
+end
View
@@ -6,16 +6,24 @@
# A temporary fix to bring active record errors up to speed with rails edge.
# I need to remove this once the new gem is released. This is only here so my tests pass.
-class ActiveRecord::Errors
- def [](key)
- value = on(key)
- value.is_a?(Array) ? value : [value].compact
+unless defined?(::ActiveModel)
+ class ActiveRecord::Errors
+ def [](key)
+ value = on(key)
+ value.is_a?(Array) ? value : [value].compact
+ end
end
end
ActiveRecord::Schema.verbose = false
-ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
+
+begin
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
+rescue ArgumentError
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
+end
+
ActiveRecord::Base.configurations = true
ActiveRecord::Schema.define(:version => 1) do
create_table :companies do |t|
@@ -171,4 +179,4 @@ def set_session_for(user, id = nil)
def unset_session
controller.session["user_credentials"] = controller.session["user_credentials_id"] = nil
end
-end
+end

0 comments on commit f8cd29c

Please sign in to comment.