Last active
December 20, 2015 03:09
-
-
Save schmurfy/6061903 to your computer and use it in GitHub Desktop.
rails_inheritance_issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'activerecord', '= 3.2.0' | |
# gem 'activerecord', '~> 4.0.0' | |
# gem 'activesupport', path: File.expand_path('../rails/activesupport', __FILE__) | |
# gem 'activemodel', path: File.expand_path('../rails/activemodel', __FILE__) | |
# gem 'activerecord', path: File.expand_path('../rails/activerecord', __FILE__) | |
gem 'sqlite3' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler/setup' | |
require 'active_record' | |
require 'sqlite3' | |
def firstname(n) | |
end | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => ':memory:' | |
) | |
ActiveRecord::Base.connection.instance_eval do | |
create_table :firstnames, :id => false do |t| | |
t.string :firstname | |
end | |
add_index :firstnames, :firstname | |
end | |
class MyBase < ActiveRecord::Base | |
self.abstract_class = true | |
end | |
class Firstnames < MyBase | |
end | |
class Firstnames2 < ActiveRecord::Base | |
self.table_name = "firstnames" | |
end | |
puts "working: " | |
Firstnames2.create(firstname: 'john') | |
puts "\nbroken: " | |
# => test.rb:7:in `firstname': wrong number of arguments (0 for 1) (ArgumentError) | |
Firstnames.create(firstname: 'john') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment