Fixed inconsistency between Mash#respond_to? and #method_missing. Added Hashie::Extensions::Mash::ActiveModel for compatibility with Rails 4 Strong Parameters. #147

Merged
merged 1 commit into from May 1, 2014

Conversation

Projects
None yet
3 participants
@dblock
Contributor

dblock commented Apr 30, 2014

I would appreciate comments on the README and the implementation. Maybe there's a way to do this automatically via Railtie or something like that (I don't know how)?

class Mash
  include Hashie::Extensions::Mash::ActiveModel
end

Closes #146 and #89.

@dblock dblock changed the title from Added Hashie::Extensions::Mash::ActiveModel for compatibility with Rails 4 Strong Parameters. to Fixed inconsistency between Mash#respond_to? and #method_missing. Added Hashie::Extensions::Mash::ActiveModel for compatibility with Rails 4 Strong Parameters. Apr 30, 2014

@7even

This comment has been minimized.

Show comment
Hide comment
@7even

7even Apr 30, 2014

Contributor

The implementation seems great (though there is a slightly better way with #respond_to_missing). But I also don't really know how to hook Mash.include Hashie::Extensions::Mash::ActiveModel in rails.

Contributor

7even commented Apr 30, 2014

The implementation seems great (though there is a slightly better way with #respond_to_missing). But I also don't really know how to hook Mash.include Hashie::Extensions::Mash::ActiveModel in rails.

@dblock

This comment has been minimized.

Show comment
Hide comment
@dblock

dblock Apr 30, 2014

Contributor

@7even I was trying to keep method_missing and respond_to? in sync. Want to suggest better?

Contributor

dblock commented Apr 30, 2014

@7even I was trying to keep method_missing and respond_to? in sync. Want to suggest better?

@dblock

This comment has been minimized.

Show comment
Hide comment
@dblock

dblock May 1, 2014

Contributor

Note #143, which is fixed with this. I am going to merge and we can continue improving the code in subsequent PRs. @7even feel free to add.

Contributor

dblock commented May 1, 2014

Note #143, which is fixed with this. I am going to merge and we can continue improving the code in subsequent PRs. @7even feel free to add.

dblock added a commit that referenced this pull request May 1, 2014

Merge pull request #147 from dblock/mash-activemodel
Fixed inconsistency between Mash#respond_to? and #method_missing. Added Hashie::Extensions::Mash::ActiveModel for compatibility with Rails 4 Strong Parameters.

@dblock dblock merged commit 6bb94f8 into intridea:master May 1, 2014

1 check failed

continuous-integration/travis-ci The Travis CI build could not complete due to an error
Details

@dblock dblock deleted the dblock:mash-activemodel branch May 1, 2014

@Maxim-Filimonov

This comment has been minimized.

Show comment
Hide comment
@Maxim-Filimonov

Maxim-Filimonov May 1, 2014

Contributor

@dblock uh oh :\ Sorry for introducing the issue. To enable it automatically you can probably do something like this

if const_defined?('ActiveModel')
  include Hashie::Extensions::Mash::ActiveModel
end

I'll look at doing PR for this later today

Contributor

Maxim-Filimonov commented May 1, 2014

@dblock uh oh :\ Sorry for introducing the issue. To enable it automatically you can probably do something like this

if const_defined?('ActiveModel')
  include Hashie::Extensions::Mash::ActiveModel
end

I'll look at doing PR for this later today

@7even

This comment has been minimized.

Show comment
Hide comment
@7even

7even May 1, 2014

Contributor

@dblock well, that way was nearly the same except you define #respond_to_missing instead of #respond_to. I think it would be more correct because #respond_to_missing is designed exactly for #method_missing-powered methods. But it will work either way so you decide.

Contributor

7even commented May 1, 2014

@dblock well, that way was nearly the same except you define #respond_to_missing instead of #respond_to. I think it would be more correct because #respond_to_missing is designed exactly for #method_missing-powered methods. But it will work either way so you decide.

@dblock

This comment has been minimized.

Show comment
Hide comment
@dblock

dblock May 1, 2014

Contributor

Oh I see. It's a lot better, implemented in 953edec.

Contributor

dblock commented May 1, 2014

Oh I see. It's a lot better, implemented in 953edec.

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