Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Rails 3.1 Compatibility #254

Merged
3 commits merged into from

4 participants

@AndreasWurm

No description provided.

@vagnerzampieri

Hey binarylogic, can you apply this patch? I want to use AuthLogic with Rails 3.1.0-beta, but without this patch it's does work. I got this message when run bundler install:

Bundler could not find compatible versions for gem "activerecord":
In Gemfile:
authlogic (= 3.0.2) depends on
activerecord (~> 3.0.7)

rails depends on
  activerecord (3.1.0.beta)

Tks

@fernandokosh

Vagner, We can use a branch of AndreasWurm for now.
Please aplly this patch, BynaryLogic.

@ghost

Can you explain what you're doing in this commit:

AndreasWurm@7b114e7

Thats the reason I haven't merged it in. I already merged in more relaxed dependencies on rails 3. Thanks.

@AndreasWurm

ive converted the whole inheritable_attribute thing to use class_attribute (which also supports inheritance).
also added a logger to AR cause it required it.

@ghost ghost merged commit c569334 into binarylogic:master
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 6, 2011
  1. @dpbus
  2. @dpbus

    update gemspec

    dpbus authored
Commits on May 8, 2011
  1. @AndreasWurm

    rails 3.1 compatibility

    AndreasWurm authored
This page is out of date. Refresh to see the latest.
View
2  Gemfile
@@ -1,6 +1,6 @@
source :rubygems
-gem 'activerecord', '~> 3.0.7'
+gem 'activerecord', '>= 3.0.7'
group :test do
gem 'bcrypt-ruby'
View
2  Gemfile.lock
@@ -42,7 +42,7 @@ PLATFORMS
ruby
DEPENDENCIES
- activerecord (~> 3.0.7)
+ activerecord (>= 3.0.7)
bcrypt-ruby
jeweler
ruby-debug19
View
12 authlogic.gemspec
@@ -206,15 +206,15 @@ Gem::Specification.new do |s|
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.7"])
- s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.7"])
+ s.add_runtime_dependency(%q<activerecord>, [">= 3.0.7"])
+ s.add_runtime_dependency(%q<activerecord>, [">= 3.0.7"])
else
- s.add_dependency(%q<activerecord>, ["~> 3.0.7"])
- s.add_dependency(%q<activerecord>, ["~> 3.0.7"])
+ s.add_dependency(%q<activerecord>, [">= 3.0.7"])
+ s.add_dependency(%q<activerecord>, [">= 3.0.7"])
end
else
- s.add_dependency(%q<activerecord>, ["~> 3.0.7"])
- s.add_dependency(%q<activerecord>, ["~> 3.0.7"])
+ s.add_dependency(%q<activerecord>, [">= 3.0.7"])
+ s.add_dependency(%q<activerecord>, [">= 3.0.7"])
end
end
View
26 lib/authlogic/acts_as_authentic/base.rb
@@ -4,6 +4,9 @@ module ActsAsAuthentic
module Base
def self.included(klass)
klass.class_eval do
+ class_attribute :acts_as_authentic_modules, :acts_as_authentic_config
+ self.acts_as_authentic_modules ||= []
+ self.acts_as_authentic_config ||= {}
extend Config
end
end
@@ -41,7 +44,7 @@ def acts_as_authentic(unsupported_options = nil, &block)
#
# That being said, this is your tool for extending Authlogic and "hooking" into the acts_as_authentic call.
def add_acts_as_authentic_module(mod, action = :append)
- modules = acts_as_authentic_modules
+ modules = acts_as_authentic_modules.clone
case action
when :append
modules << mod
@@ -49,21 +52,17 @@ def add_acts_as_authentic_module(mod, action = :append)
modules = [mod] + modules
end
modules.uniq!
- write_inheritable_attribute(:acts_as_authentic_modules, modules)
+ self.acts_as_authentic_modules = modules
end
# This is the same as add_acts_as_authentic_module, except that it removes the module from the list.
def remove_acts_as_authentic_module(mod)
- acts_as_authentic_modules.delete(mod)
- acts_as_authentic_modules
+ modules = acts_as_authentic_modules.clone
+ modules.delete(mod)
+ self.acts_as_authentic_modules = modules
end
-
+
private
- def acts_as_authentic_modules
- key = :acts_as_authentic_modules
- inheritable_attributes.include?(key) ? read_inheritable_attribute(key) : []
- end
-
def db_setup?
begin
column_names
@@ -75,9 +74,12 @@ def db_setup?
def rw_config(key, value, default_value = nil, read_value = nil)
if value == read_value
- inheritable_attributes.include?(key) ? read_inheritable_attribute(key) : default_value
+ acts_as_authentic_config.include?(key) ? acts_as_authentic_config[key] : default_value
else
- write_inheritable_attribute(key, value)
+ config = acts_as_authentic_config.clone
+ config[key] = value
+ self.acts_as_authentic_config = config
+ value
end
end
View
12 lib/authlogic/session/foundation.rb
@@ -6,6 +6,9 @@ module Session
module Foundation
def self.included(klass)
klass.class_eval do
+ class_attribute :acts_as_authentic_config
+ self.acts_as_authentic_config ||= {}
+
extend ClassMethods
include InstanceMethods
end
@@ -15,10 +18,13 @@ module ClassMethods
private
def rw_config(key, value, default_value = nil, read_value = nil)
if value == read_value
- return read_inheritable_attribute(key) if inheritable_attributes.include?(key)
- write_inheritable_attribute(key, default_value)
+ return acts_as_authentic_config[key] if acts_as_authentic_config.include?(key)
+ rw_config(key, default_value)
else
- write_inheritable_attribute(key, value)
+ config = acts_as_authentic_config.clone
+ config[key] = value
+ self.acts_as_authentic_config = config
+ value
end
end
end
View
3  test/test_helper.rb
@@ -6,6 +6,9 @@
#ActiveRecord::Schema.verbose = false
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
+logger = Logger.new(STDOUT)
+logger.level= Logger::FATAL
+ActiveRecord::Base.logger = logger
ActiveRecord::Base.configurations = true
ActiveRecord::Schema.define(:version => 1) do
Something went wrong with that request. Please try again.