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
NoMethodError (undefined method `tag=' for #<Hash:0x64c1ac0>) #435
Comments
+1 |
Move require 'yaml'
YAML::ENGINE.yamler = 'syck' to config/application.rb after require File.expand_path('../boot', __FILE__) and before if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end |
@albus522's solution worked for me, thanks! |
Okay, this solves the problem. Thank you! But, could you please explain why this problem occurs? I'm interested because of another issue we had with YaML de-serialization once. |
When you require yaml before boot, bundler is not setup yet and weird things happen. |
We are having the same error but in conjunction with IdentityCache https://github.com/Shopify/identity_cache record = <a model object>
coder = { :class => record.class }
record.encode_with(coder) You overwrite def encode_with_override(coder)
encode_with_without_override(coder)
coder.tag = "!ruby/ActiveRecord:#{self.class.name}"
end but the coder is a Hash object, with doesn't have a tag attribute. What do you expect to be a coder? It obviously also breaks with other gems. |
+1, we're seeing the same problem that @joker-777 is seeing. Any thoughts on how to fix? Edit: I added
To my application.rb as suggested above. This was able to get normal fetch operations working but only if I didn't have any assocaitions (ie: cache_has_many, etc). If I add those, it fails every time with:
Thoughts? |
@joker-777 i am doing the same thing, identity_cache + delayed_job and they don't seem to like each other in the same app. what did you end up doing? |
I got ActiveRecord::Base.class_eval do
def encode_with_override_override(coder)
encode_with_without_override(coder)
coder.tag = "!ruby/ActiveRecord:#{self.class.name}" unless coder.is_a? ::Hash
end
alias_method :encode_with, :encode_with_override_override
end |
Hi!
I'm trying to send a delayed email:
UserMailer.delay.gift_confirmed_email(gift)
And I get NoMethodError (undefined method `tag=' for #Hash:0x64c1ac0)
In environment.rb I have:
require 'yaml'
YAML::ENGINE.yamler = 'syck'
Gems included by the bundle:
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
I will appreciate any advice.
Thank you!
The text was updated successfully, but these errors were encountered: