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

incompatible with rubyamf? #5

Open
linzhp opened this issue Jun 24, 2009 · 2 comments
Open

incompatible with rubyamf? #5

linzhp opened this issue Jun 24, 2009 · 2 comments

Comments

@linzhp
Copy link

linzhp commented Jun 24, 2009

I feel cache_money is great, especially for its support of transaction. I haven't seen any others provide such feature.
However, I need to use rails as the backend of a Flex project, and use rubyamf (http://code.google.com/p/rubyamf/) to communicate with the front side. When an ActiveRecord (e.g. User) is configured with class mapping:

  ClassMappings.register(
  :actionscript => 'model.UserModel',
  :ruby => 'User',
  :type => 'active_record',
  :attributes => ["id", "name"],
  :associations  =>{ :for_default=>[] })

User.find 1 reports some error:
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.indices
from (DELEGATION):2:in __send__' from (__DELEGATION__):2:inindices'
from (DELEGATION):2:in __send__' from (__DELEGATION__):2:inindices'
from /home/clive/ruby/RailsApplication1/vendor/plugins/nkallen-cache-money/lib/cash/query/abstract.rb:114:in indexed_on?' from /home/clive/ruby/RailsApplication1/vendor/plugins/nkallen-cache-money/lib/cash/query/abstract.rb:56:incacheable?'
from /home/clive/ruby/RailsApplication1/vendor/plugins/nkallen-cache-money/lib/cash/query/abstract.rb:15:in perform' from /home/clive/ruby/RailsApplication1/vendor/plugins/nkallen-cache-money/lib/cash/query/primary_key.rb:17:inperform'
from /home/clive/ruby/RailsApplication1/vendor/plugins/nkallen-cache-money/lib/cash/query/abstract.rb:7:in perform' from /home/clive/ruby/RailsApplication1/vendor/plugins/nkallen-cache-money/lib/cash/finders.rb:29:infind_from_ids'
from /home/clive/ruby/RailsApplication1/vendor/rails/activerecord/lib/active_record/base.rb:590:in `find'
from (irb):1

and index [:name] in User class also reports:
home/clive/ruby/RailsApplication1/vendor/rails/activerecord/lib/active_record/base.rb:1833:in method_missing':NoMethodError: undefined methodindex' for #Class:0xb730f374

I couldn't find a way to attach the rails project I created here. If some one has problem in reproduce the issue, feel free to contact me

@deedubs
Copy link

deedubs commented Aug 18, 2009

Are you using ActiveRecord SessionStore?

@linzhp
Copy link
Author

linzhp commented Aug 19, 2009

Thanks for your reply. I've figured out the problem. Rubyamf needs to be loaded after cache_money, otherwise cache_money won't be able to override ActiveRecord

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

No branches or pull requests

2 participants