Reputation: 26212
When I add this to my Gemfile :
gem 'savon', '~> 2.0'
And run bundle install
. And try to start a rails console
I get this error :
app/models/user.rb:6:in `include': wrong argument type Class (expected Module) (TypeError)
from app/models/user.rb:6:in `<class:User>'
from app/models/user.rb:3:in `<top (required)>'
Removing gem removes the issue, what's the problem I really don't know how to take it from here. Any suggestions?
Update (ruby version output):
ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-darwin13.2.0]
Update II (relevant model bit):
class User < ActiveRecord::Base
include InstanceMethodsOnActivation
include GoingPostal
include UUID
include Wizard
include PublicActivity::Common
line 3 is the class definition and the line 6 is the UUID. Here is the uuid :
module UUID
extend ActiveSupport::Concern
def uuid
HASHIDS.encrypt(id)
end
def to_param
uuid
end
module ClassMethods
def find_by_uuid(uuid)
self.find_by_id(HASHIDS.decrypt(uuid)) unless uuid.nil?
end
def find_by_uuid!(uuid)
self.find_by_id!(HASHIDS.decrypt(uuid)) unless uuid.nil?
end
end
end
Upvotes: 1
Views: 274
Reputation: 84124
One of the dependencies of the savon gem is the uuid gem, which provides a UUID
class.
In development mode where application code is only loaded on demand this means that your uuid file is never loaded and UUID
is the class from the gem.
In production, depending on where the file is and your eager load settings rails would probably try and load your file at app startup and you'd get an error because you're creating a class with the same name as a module
The simplest thing would be to rename your module - either pick a different name entirely or namespace it.
Upvotes: 1