Rspec + Rails: table_name_prefix not loaded for module -
when run rspec on specific file:
rspec spec/models/my_namespace/my_model_spec.rb
i run error because rspec appears not load app/models/my_namespace.rb, contains declaration of self.table_name_prefix
. in fact, if use pry , run mynamepsace.table_name_prefix # => nomethoderror: undefined method ``table_name_prefix'
.
when try query db rails console (no rspec), works, though: mynamespace::mymodel.where(foo:'bar') # => [...]
any idea problem or fix is?
rails 3.2.14, ruby 1.9.3, debian
at top of spec file:
require_relative '../../../app/models/my_namespace'
this load namespace file specifies table prefix.
Comments
Post a Comment