Last active
February 24, 2017 21:59
-
-
Save jasper-lyons/cc8353eccb7ced2e2e67006025dd6567 to your computer and use it in GitHub Desktop.
ROM "undefined method 'base_name' for #<..." 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
require 'rom' | |
require 'rom-repository' | |
require 'byebug' | |
config = ROM::Configuration.new(:memory) | |
class Accounts < ROM::Relation[:memory] | |
register_as :accounts | |
end | |
class Create < ROM::Commands::Create[:memory] | |
register_as :create | |
relation :accounts | |
result :one | |
def execute(tuple) | |
byebug | |
end | |
end | |
class AccountRepo < ROM::Repository[:accounts] | |
commands :create | |
end | |
config.register_relation(Accounts) | |
container = ROM.container(config) | |
repo = AccountRepo.new(container) | |
repo.create({}) | |
<<-OUTPUT | |
(refactor/repository_pattern) referral-campaign/links$ bundle exec ruby test.rb | |
/Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-3.0.3/lib/rom/plugins/relation/registry_reader.rb:31:in `block in method_missing': undefined method `base_name' for #<Accounts dataset=#<ROM::Memory::Dataset data=[]>> (NoMethodError) | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-3.0.3/lib/rom/registry.rb:33:in `block in fetch' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-3.0.3/lib/rom/registry.rb:32:in `fetch' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-3.0.3/lib/rom/registry.rb:32:in `fetch' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-3.0.3/lib/rom/plugins/relation/registry_reader.rb:31:in `method_missing' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-repository-1.1.0/lib/rom/repository/relation_proxy.rb:247:in `base_name' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-repository-1.1.0/lib/rom/repository/relation_proxy.rb:208:in `to_ast' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-repository-1.1.0/lib/rom/repository.rb:331:in `compile_command' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-repository-1.1.0/lib/rom/repository.rb:175:in `block in command' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.4/lib/concurrent/map.rb:133:in `block in fetch_or_store' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.4/lib/concurrent/map.rb:122:in `fetch' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.4/lib/concurrent/map.rb:132:in `fetch_or_store' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-repository-1.1.0/lib/rom/repository.rb:174:in `command' | |
from /Users/jasperlyons/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rom-repository-1.1.0/lib/rom/repository/class_interface.rb:120:in `block in define_command_method' | |
from test.rb:29:in `<main>' | |
OUPUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment