Question

I am attempting to deploy a site onto engineyard and I keep getting an error that seems to be a data formatting error. This only happens when deployed as production onto the server cluster. using the same DB and codebase locally or on a VPS we have no issues. The errors seem to me to show that suddenly there is an array / hash type mismatch with some of the user data. It always seems to trace back to the model where it is tasked to get 'options'. The errors are triggered by the templates calling for access of checks on user attributes.

production log: 
 Completed 500 Internal Server Error in 32ms
 ** [Airbrake] Failure: Net::HTTPClientError

 ActionView::Template::Error (can't convert Symbol into Integer):
    18:         = admin_user.username
    19:         = username_helper(admin_user)
    20:       %td= country_image admin_user
    21:       %td= admin_user.account_name
    22:       %td
    23:         - if admin_user.is_a?(Creative)
    24:           - if admin_user.is_juror?
  app/models/user.rb:79:in `[]'
  app/models/user.rb:79:in `has_option?'
  app/models/contest_holder.rb:77:in `is_client_type?'
  app/models/contest_holder.rb:81:in `is_agent?'
  app/models/contest_holder.rb:70:in `ao_client_name'
  app/models/contest_holder.rb:115:in `account_name'
  app/views/admin/users/_users.html.haml:21:in `block in _app_views_admin_users__users_html_haml__845309245401675393_70184787547360'

trace:
ActionView::Template::Error: can't convert Symbol into Integer
Sample stack trace (show Rails)
 /app/models/user.rb:  79:in `[]'
 /app/models/user.rb:  79:in `has_option?'
…P/releases/20130814153250/app/models/contest_holder.rb:  77:in `is_client_type?'
…P/releases/20130814153250/app/models/contest_holder.rb:  81:in `is_agent?'
…P/releases/20130814153250/app/models/contest_holder.rb:  70:in `ao_client_name'
…P/releases/20130814153250/app/models/contest_holder.rb: 115:in `account_name'
…1/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:  10:in `block in render_with_haml'
…ed_gems/ruby/1.9.1/gems/haml-4.0.3/lib/haml/helpers.rb:  89:in `non_haml'
…1/gems/haml-4.0.3/lib/haml/helpers/action_view_mods.rb:  10:in `render_with_haml'
…ms/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:  68:in `block in call'
…ms/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:  56:in `each'
…ms/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:  56:in `call'
…uby/1.9.1/gems/omniauth-1.1.4/lib/omniauth/strategy.rb: 184:in `call!'
…uby/1.9.1/gems/omniauth-1.1.4/lib/omniauth/strategy.rb: 164:in `call'
…uby/1.9.1/gems/omniauth-1.1.4/lib/omniauth/strategy.rb: 184:in `call!'
…uby/1.9.1/gems/omniauth-1.1.4/lib/omniauth/strategy.rb: 164:in `call'
…uby/1.9.1/gems/omniauth-1.1.4/lib/omniauth/strategy.rb: 184:in `call!'
…uby/1.9.1/gems/omniauth-1.1.4/lib/omniauth/strategy.rb: 164:in `call'
…ruby/1.9.1/gems/omniauth-1.1.4/lib/omniauth/builder.rb:  49:in `call'
…VP/releases/20130814153250/lib/middleware/force_ssl.rb:   8:in `call'
…ems/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb:  35:in `block in call'
…ems/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb:  34:in `catch'
…ems/ruby/1.9.1/gems/warden-1.2.1/lib/warden/manager.rb:  34:in `call'
…ndled_gems/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:  23:in `call'
…/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:  25:in `call'
…/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb: 210:in `context'
…/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb: 205:in `call'
…es/20130814153250/config/initializers/session_store.rb:  10:in `call'

code from user.rb which seems to be the point of contact for the error:

def has_option?(option)
 self.options[option] && self.options[option].to_s == "1"
end

an example of an options value: --- !map:ActiveSupport::HashWithIndifferentAccess is_agent: "1"

Was it helpful?

Solution

Came to find out that the issue was an additional line break within the database file. Specifically the application uses serialized yaml data a fair amount. An additional line break had been added between the yaml hash key and value causing an error within the object. We initially tried creating a script to cleanse the db and came to find it seemed to be simply corrupt from the original db file.

OTHER TIPS

This was what wrong with my case

Error : ActionView::Template::Error (can't convert Symbol into Integer)

Reason:

In my haml.

I was trying to access a property from a json object.

object[:key]

But actually it was a json array(Array of entities from active record where clause). I just filtered the first element.

Hope someone will find useful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top