Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Revert change to private for inherited to prevent change to resource #73

Merged
merged 1 commit into from
Apr 1, 2015

Conversation

tpitale
Copy link
Member

@tpitale tpitale commented Mar 24, 2015

inherited being made public by dm

This change 145100d#diff-3fa714c2908862ba7f6e400ced298674

Causes this issue in dm-is-list datamapper/dm-is-list#6

Which lead to this attempted change in dm-core: datamapper/dm-core#277

And subsequent discussion lead to making this script: https://gist.github.com/tpitale/b67e1f86763ba6ea0b75

To find that dm-validations was switching inherited from public back to private.

@tpitale
Copy link
Member Author

tpitale commented Mar 24, 2015

This passes locally. We'll see what CI has to say.

@solnic
Copy link
Contributor

solnic commented Mar 24, 2015

Why not change dm-is-list and just do:

def self.inherited(model)
  super
  model.instance_variable_set(:@list_options, @list_options.dup)
end

??

@tpitale
Copy link
Member Author

tpitale commented Mar 24, 2015

I assume that dm-core makes inherited public for a reason.

@tpitale
Copy link
Member Author

tpitale commented Mar 24, 2015

https://github.com/datamapper/dm-core/blob/099d9795d95f78a26b773a8f997c0a55ea7fd619/lib/dm-core/model.rb#L226 is where I think it's made public … maybe that is not intentional. It says that the api is private, but there's nothing that makes it so.

@solnic
Copy link
Contributor

solnic commented Mar 24, 2015

whatever dm-core is doing should probably stay untouched wrt this method visibility; I'd still look into dm-is-list and try to do what I suggested, using dm's hooks instead of just overloading inherited and calling super feels weird.

@tpitale
Copy link
Member Author

tpitale commented Mar 24, 2015

Yeah, I think we should make the change you suggested to dm-is-list.

But you think this PR is also still valid?

@tillsc
Copy link
Contributor

tillsc commented Mar 24, 2015

+1 . Let us restore a stable state first. As long as inherited has been documented as "public" in the past it should stay public in all 1.x versions.

But I also think that it would absolutely make sense to implement @solnic's changes in dm-is-list too.

@tpitale
Copy link
Member Author

tpitale commented Apr 1, 2015

I think the change that @solnic suggested has been merged into dm-is-list. I think this is probably good to go now, too.

solnic added a commit that referenced this pull request Apr 1, 2015
Revert change to private for inherited to prevent change to resource
@solnic solnic merged commit 81ff78d into master Apr 1, 2015
@solnic solnic deleted the revert-private-inherited branch April 1, 2015 12:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants