Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixes a bug in the name... not sure if this breaks something elsewhere! #6

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

maxsum-corin commented May 17, 2011

Hi,

I was trying to add a relationship on a session to a user. i.e.

#app/model/session.rb
require 'dm-rails/session_store'
class Session < Rails::DataMapper::SessionStore::Session
  belongs_to :user, :required => false
end

#config\initializers\session_store.rb
require 'dm-rails/session_store'
Rails::DataMapper::SessionStore.session_class = Session
My::Application.config.session_store Rails::DataMapper::SessionStore

But I kept hitting this error: Cannot find the parent_model User for session in user

This patch fixes my problem. I'm not sure if this has any unintended side-effects... not sure why self.name is overwritten in the first place. Case matters when DataMapper::Ext::Module.find_const comes to find the Model class for the belongs_to relationship; not sure if any other code relies on lower case.

Please let me know if I'm going about this the wrong way.

Cheers,
Corin

Owner

tpitale commented Feb 14, 2016

I'll take a look, thanks @maxsum-corin.

@tpitale tpitale added this to the 1.3.0 milestone Feb 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment