{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/2cdc5c3059c40c76d5ca7bec8d149f9e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"2cdc5c3059c40c76d5ca7bec8d149f9e","url":"https://api.github.com/users/rantav","login":"rantav","id":87037},"milestone":null,"labels":[],"assignee":null,"updated_at":"2011-11-10T13:09:16Z","closed_at":null,"comments":1,"url":"https://api.github.com/repos/beerlington/classy_enum/issues/7","body":"Hi, I'm seeing some weird behavior that I can't explain and it seems to be related to classy_enum.\r\nIn my model I have:\r\n\r\n    class Message < ActiveRecord::Base\r\n      classy_enum_attr :message_type\r\n\r\nAnd I have the required enums and everything and it seems to work great. (I've used classy_enum in the past, so it's not my first enum. Other times didn't render a model with enums though)\r\n\r\nThe problem is that when I want to render a @message in the controller I get a stack overflow and sometimes (but not always) a complete server crash with class_enum in the stack\r\n\r\n````\r\nUsers/ran/.rvm/gems/ruby-1.9.2-p290/gems/classy_enum-1.3.0/lib/classy_enum/class_methods.rb:58:in `const_get': uninitialized constant MessageTypeUser (NameError)\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/classy_enum-1.3.0/lib/classy_enum/class_methods.rb:58:in `build'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/classy_enum-1.3.0/lib/classy_enum/attributes.rb:39:in `block (2 levels) in classy_enum_attr'\r\n\tfrom /Users/ran/dev/invi-backend/app/models/message.rb:16:in `to_s'\r\n\tfrom /Users/ran/dev/invi-backend/lib/messaging.rb:22:in `block in send'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:141:in `call'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:141:in `set_deferred_status'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:180:in `fail'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/pusher-0.8.3/lib/pusher/channel.rb:51:in `block in trigger_async'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:141:in `call'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:141:in `set_deferred_status'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/em/deferrable.rb:180:in `fail'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/em-http-request-0.3.0/lib/em-http/client.rb:310:in `unbind'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:1417:in `event_callback'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/handler/thin.rb:14:in `run'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:217:in `start'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands/server.rb:65:in `start'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands.rb:30:in `block in <top (required)>'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands.rb:27:in `tap'\r\n\tfrom /Users/ran/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands.rb:27:in `<top (required)>'\r\n\tfrom script/rails:6:in `require'\r\n\tfrom script/rails:6:in `<main>'\r\n````\r\n\r\nIt's hard to say what exactly is causing this.... but when I remove the classy enum definition in the model the crash doesn't happen.\r\n\r\nDoes this ring a bell?  Have you any idea why is this or how to solve that?\r\n\r\nthanks!","html_url":"https://github.com/beerlington/classy_enum/issues/7","number":7,"title":"Stack overflow when using classy_enum in the render function","id":2197493,"created_at":"2011-11-10T12:48:46Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/45b75f9f866d240362c0d7fa125025ba?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"45b75f9f866d240362c0d7fa125025ba","url":"https://api.github.com/users/beerlington","login":"beerlington","id":77580},"updated_at":"2011-11-10T13:09:16Z","url":"https://api.github.com/repos/beerlington/classy_enum/issues/comments/2694974","body":"I have not seen that issue before. Could you post your MessageType enum class so I can try and reproduce it locally?","id":2694974,"created_at":"2011-11-10T13:09:16Z"}}