Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rails 4.2.2 wrong computed class type
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails'
gem 'arel'
gem 'rack'
gem 'i18n'
gem 'pry-rails'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
require 'bundler'
Bundler.setup(:default)
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
create_table :servers do |t|
end
create_table :local_drives do |t|
end
end
class LocalDrive < ActiveRecord::Base
end
class Server < ActiveRecord::Base
has_many :local_drives
end
class BugTest < Minitest::Test
def test_habtm_reflections_with_nonstandard_name_and_class_name_option_work_correctly
server = Server.create!
server.local_drives << LocalDrive.create!
# here you'll have the error
# NameError: uninitialized constant Server::LocalDrife
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.