rubymotion-community / motion-support

Commonly useful extensions to the standard library for RubyMotion
MIT License
132 stars 28 forks source link

Squash RM compliant that symbolize_keys!/deep_symbolize_keys! ... #8

Closed DougPuchalski closed 11 years ago

DougPuchalski commented 11 years ago

...fined

Similar to previous fix.

tkadauke commented 11 years ago

This change breaks specs on HashWithIndifferentAccess#symbolize_keys. Why do you need this change anyways? You can just require 'motion-support/core_ext/hash', which should work fine. The correct fix would be to require the dependency 'core_ext/hash/keys' at the top of this file.

DougPuchalski commented 11 years ago

Sorry for having missed the spec failure. Without this fix the compile bombs in my MotionModel sql branch, I thought it was a RM issue. If this fix is bad then maybe we need to look at https://github.com/aceofspades/motion-support/commit/569fd3615c05cf19893d67f265794ecba2a4ece5 as well.

I am unable to get anything to work with motion_require. When I add the dependency you note, I get

undefined method `motion_require' for main:TopLevel (NoMethodError)
tkadauke commented 11 years ago

Are you using Bundler? Try adding motion-require to your Gemfile first. If you don't use Bundler, add a require 'motion-require' to your Rakefile before you require anything from motion-support. Also, do you use tge newest version of both motion-support and motion-require? There have been some issues similar to what you describe.

tkadauke commented 11 years ago

Are you using Bundler? Try adding motion-require to your Gemfile first. If you don't use Bundler, add a require 'motion-require' to your Rakefile before you require anything from motion-support. Also, do you use tge newest version of both motion-support and motion-require? There have been some issues similar to what you describe.

tkadauke commented 11 years ago

One more thing. Do you get this errr when running rake or when the app runs? You need to require 'motion-support/core_ext/hash' from your Rakefile.

DougPuchalski commented 11 years ago

Clear on your bundler advice, no help. The error happens on rake.

You're saying I have to separately require motion-support/core_ext/hash which is required by motion/hash_with_indfifferent_access?

tkadauke commented 11 years ago

Just look at the README. Add the require statement to your Rakefile and all relevant files should be added to your project.

DougPuchalski commented 11 years ago

I'm not using partial loading, or am I missing something?

tkadauke commented 11 years ago

I don't understand what you mean by that. You either require all of motion-support (require 'motion-support') or you pick the parts that you want, a.k.a. partial loading (require 'motion-support/core_ext/hash'). Putting either of these require statements in your Rakefile should solve your problem. If not, let me know.

DougPuchalski commented 11 years ago

Right. I am requiring motion-support in its entirety. This seems like a motion-require problem, I can't figure out how it could be fundamentally broken like that.

These issues are killing me, so much wasted time. I am trying to release SQL for MotionModel which is huge, but it depends on this, and I can't even get it to compile with a motion_require statement.

tkadauke commented 11 years ago

If you want me to take a look at it, I'd be happy to help out.

DougPuchalski commented 11 years ago

Thanks for offering, maybe something will click for you. Check out this branch and just try to run specs.

https://github.com/aceofspades/MotionModel/tree/motion_support_master

You'll get

2013-05-06 09:43:01.970 MotionModel[21585:c07] undefined method `symbolize_keys!' for class `MotionSupport::HashWithIndifferentAccess' (NameError)
2013-05-06 09:43:01.973 MotionModel[21585:c07] *** Terminating app due to uncaught exception 'NameError', reason: 'undefined method `symbolize_keys!' for class `MotionSupport::HashWithIndifferentAccess' (NameError)
'
*** First throw call stack:
(0x1e90012 0x800e7e 0x399e44 0xa255 0x90cd)
libc++abi.dylib: terminate called throwing an exception

If I add the motion_require statement you suggest, I get

undefined method `motion_require' for main:TopLevel (NoMethodError)
tkadauke commented 11 years ago

Commit 100e1b82631c9731297bd62e873a5bfae37cb2ed fixed things properly. Closing.