steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-18 22:11 UTC
SerializationTypeMismatch in Production Mode
In production mode, I keep getting this error the 2nd time it loads a page with a serialized attribute: ActiveRecord::SerializationTypeMismatch (answers_container was supposed to be a Array, but was a NilClass): /vendor/rails/activerecord/lib/active_record/base.rb:1964:in `unserialize_attribute'' In development, it works fine. In fact, if I set to false config.cache_classes in production.rb, it works fine. The first time you hit the page, it works fine. Upon refresh, it returns that error. This happens with both webbrick and litespeed. The controller code is: def new store_location if request.env["HTTP_REFERER"] params[:my_id] = "survey" if request.env["HTTP_REFERER"].include? "survey" end @question = Question.new @question.answers_container = Array.new(2, "") @question.creator_message = current_user[:note] if logged_in? end In my model, I define the serialized attribute as such: serialize :answers_container, Array I was running rails 1.2, then upgraded to 1.2.2 after seeing I have this problem. I believe when I was running 1.1.6 I did not have this problem. Does anyone have any suggestions? Steve niblets.wordpress.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
What databases are you using (mysql? postgres?, ...) ? Are they different in development and production? -carl On 2/18/07, steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > In production mode, I keep getting this error the 2nd time it loads a > page with a serialized attribute: > > ActiveRecord::SerializationTypeMismatch (answers_container was > supposed to be a Array, but was a NilClass): > /vendor/rails/activerecord/lib/active_record/base.rb:1964:in > `unserialize_attribute'' > > In development, it works fine. In fact, if I set to false > config.cache_classes in production.rb, it works fine. > > The first time you hit the page, it works fine. Upon refresh, it > returns that error. > > This happens with both webbrick and litespeed. > > The controller code is: > > def new > store_location > if request.env["HTTP_REFERER"] > params[:my_id] = "survey" if > request.env["HTTP_REFERER"].include? "survey" > end > @question = Question.new > @question.answers_container = Array.new(2, "") > @question.creator_message = current_user[:note] if logged_in? > end > > In my model, I define the serialized attribute as such: > serialize :answers_container, Array > > I was running rails 1.2, then upgraded to 1.2.2 after seeing I have > this problem. I believe when I was running 1.1.6 I did not have this > problem. > > Does anyone have any suggestions? > > Steve > niblets.wordpress.com > > > > >-- EPA Rating: 3000 Lines of Code / Gallon (of coffee) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-19 01:16 UTC
Re: SerializationTypeMismatch in Production Mode
Both mysql. Everything is the same. In fact, on my local machine, both production and development databases use the same mysql database. On Feb 18, 6:58 pm, "Carl Lerche" <carl.ler...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What databases are you using (mysql? postgres?, ...) ? Are they > different in development and production? > > -carl > > On 2/18/07, steve.o...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <steve.o...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > In production mode, I keep getting this error the 2nd time it loads a > > page with a serialized attribute: > > > ActiveRecord::SerializationTypeMismatch (answers_container was > > supposed to be a Array, but was a NilClass): > > /vendor/rails/activerecord/lib/active_record/base.rb:1964:in > > `unserialize_attribute'' > > > In development, it works fine. In fact, if I set to false > > config.cache_classes in production.rb, it works fine. > > > The first time you hit the page, it works fine. Upon refresh, it > > returns that error. > > > This happens with both webbrick and litespeed. > > > The controller code is: > > > def new > > store_location > > if request.env["HTTP_REFERER"] > > params[:my_id] = "survey" if > > request.env["HTTP_REFERER"].include? "survey" > > end > > @question = Question.new > > @question.answers_container = Array.new(2, "") > > @question.creator_message = current_user[:note] if logged_in? > > end > > > In my model, I define the serialized attribute as such: > > serialize :answers_container, Array > > > I was running rails 1.2, then upgraded to 1.2.2 after seeing I have > > this problem. I believe when I was running 1.1.6 I did not have this > > problem. > > > Does anyone have any suggestions? > > > Steve > > niblets.wordpress.com > > -- > EPA Rating: 3000 Lines of Code / Gallon (of coffee)--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---