Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove ActiveRecord::Base#class_name [#379 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit 735a4db6854e73e871e6b01ec003f0670cc5ee14 1 parent 417125e
@dtrasbo dtrasbo authored josevalim committed
View
8 activerecord/lib/active_record/base.rb
@@ -720,14 +720,6 @@ def set_sequence_name(value = nil, &block)
end
alias :sequence_name= :set_sequence_name
- # Turns the +table_name+ back into a class name following the reverse rules of +table_name+.
- def class_name(table_name = table_name) # :nodoc:
- # remove any prefix and/or suffix from the table name
- class_name = table_name[table_name_prefix.length..-(table_name_suffix.length + 1)].camelize
- class_name = class_name.singularize if pluralize_table_names
- class_name
- end
-
# Indicates whether the table associated with this class exists
def table_exists?
connection.table_exists?(table_name)
View
19 activerecord/test/cases/base_test.rb
@@ -798,25 +798,6 @@ def test_attribute_keys_on_new_instance
assert_raise(NoMethodError) { t.title2 }
end
- def test_class_name
- assert_equal "Firm", ActiveRecord::Base.class_name("firms")
- assert_equal "Category", ActiveRecord::Base.class_name("categories")
- assert_equal "AccountHolder", ActiveRecord::Base.class_name("account_holder")
-
- ActiveRecord::Base.pluralize_table_names = false
- assert_equal "Firms", ActiveRecord::Base.class_name( "firms" )
- ActiveRecord::Base.pluralize_table_names = true
-
- ActiveRecord::Base.table_name_prefix = "test_"
- assert_equal "Firm", ActiveRecord::Base.class_name( "test_firms" )
- ActiveRecord::Base.table_name_suffix = "_tests"
- assert_equal "Firm", ActiveRecord::Base.class_name( "test_firms_tests" )
- ActiveRecord::Base.table_name_prefix = ""
- assert_equal "Firm", ActiveRecord::Base.class_name( "firms_tests" )
- ActiveRecord::Base.table_name_suffix = ""
- assert_equal "Firm", ActiveRecord::Base.class_name( "firms" )
- end
-
def test_null_fields
assert_nil Topic.find(1).parent_id
assert_nil Topic.create("title" => "Hey you").parent_id
Please sign in to comment.
Something went wrong with that request. Please try again.