Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite #kind_of? and #is_a? in Draper::DecoratedEnumerableProxy #95

Merged
merged 2 commits into from
Jan 5, 2012
Merged

Conversation

tmaier
Copy link
Contributor

@tmaier tmaier commented Dec 7, 2011

This is my try to fix issue #92, where draper interferes with rails' FormHelper.

I overwrote kind_of? and its alias is_a? to return true either when DecoratedEnumerableProxy or @wrapped_collection is kind of this class.

As DecoratedEnumerableProxy mirrors all method calls etc. to the @wrapped_collection, this is fine for me.

Overwriting of kind_of? at Draper::Basecould be also a solution to get the cancan gem working with draper. But I have to admit, I haven't tried it yet.

@tmaier
Copy link
Contributor Author

tmaier commented Dec 7, 2011

I just realized, what I wanted to do for cancan support has been done already in #72. Great work!
If you need more specs for this (similar as the one in this pull request), then check out https://github.com/tmaier/draper/tree/issue-8

steveklabnik added a commit that referenced this pull request Jan 5, 2012
Overwrite #kind_of? and #is_a? in Draper::DecoratedEnumerableProxy
@steveklabnik steveklabnik merged commit 1c9cb11 into drapergem:master Jan 5, 2012
@steveklabnik
Copy link
Member

I like it! Thank you.

@tmaier
Copy link
Contributor Author

tmaier commented Jan 5, 2012

Thanks @steveklabnik for mergin this. I started a new pull request #110 to increase the consistency and to add is_a? to Draper::Base.

It's based on the https://github.com/tmaier/draper/tree/issue-8 branch mentioned above.

@steveklabnik
Copy link
Member

I merged that one in too. :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants