Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #12000 from wangjohn/deprecating_class_name_string…

…_in_fixtures

Deprecating passing strings as class name in fixtures.
  • Loading branch information...
commit 8f7b3e166a3e5fe072263a5b7d4e115c1a49c2d4 2 parents 3abeaf0 + 92b0ce9
Santiago Pastorino spastorino authored
Showing with 1 addition and 7 deletions.
  1. +1 −7 activerecord/lib/active_record/fixtures.rb
8 activerecord/lib/active_record/fixtures.rb
View
@@ -507,6 +507,7 @@ def initialize(connection, name, class_name, path)
if class_name.is_a?(Class) # TODO: Should be an AR::Base type class, or any?
@model_class = class_name
else
+ ActiveSupport::Deprecation.warn("The ability to pass in strings as a class name will be removed in Rails 4.1, consider using the class itself instead.")
@model_class = class_name.constantize rescue nil
end
@@ -743,13 +744,6 @@ module ClassMethods
# 'namespaced/fixture' => Another::Model
#
# The keys must be the fixture names, that coincide with the short paths to the fixture files.
- #--
- # It is also possible to pass the class name instead of the class:
- # set_fixture_class 'some_fixture' => 'SomeModel'
- # I think this option is redundant, i propose to deprecate it.
- # Isn't it easier to always pass the class itself?
- # (2011-12-20 alexeymuranov)
- #++
def set_fixture_class(class_names = {})
self.fixture_class_names = self.fixture_class_names.merge(class_names.stringify_keys)
end
Please sign in to comment.
Something went wrong with that request. Please try again.