Skip to content

Commit

Permalink
get rid of AS attribute_accessors deprecation message.
Browse files Browse the repository at this point in the history
The file was moved and we need to require a different path.
This change should only apply to Rails 4.1 and above.

This will eliminate the following deprecation message:

```
DEPRECATION WARNING: The cattr_* method definitions have been moved into active_support/core_ext/module/attribute_accessors. Please require that instead. (called from require at /Users/senny/Projects/protected_attributes/test/abstract_unit.rb:3)
```
  • Loading branch information
senny committed Dec 11, 2013
1 parent 848c601 commit 875689d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/abstract_unit.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
require 'action_dispatch'
require 'action_controller'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/dependencies'

def active_support_4_0?
ActiveSupport::VERSION::MAJOR == 4 && ActiveSupport::VERSION::MINOR == 0
end

if active_support_4_0?
require 'active_support/core_ext/class/attribute_accessors'
else
require 'active_support/core_ext/module/attribute_accessors'
end

module SetupOnce
extend ActiveSupport::Concern

Expand Down

0 comments on commit 875689d

Please sign in to comment.