I am serializing an attribute in my model with serialize :data
The data in question is a hash defined as
{:terminal_id => terminal_id, :order_data => table_order_data, :table_id
=> table_id}
I have deployed my app on a few machines and it works well, storing the
data above in serialized format as follows:
---
:terminal_id: DellXP
:order_data: !map:ActiveSupport::HashWithIndifferentAccess
tableID: "39"
orderData: !map:ActiveSupport::HashWithIndifferentAccess
items: !map:ActiveSupport::HashWithIndifferentAccess
"0": !map:ActiveSupport::HashWithIndifferentAccess
amount: "1"
product: !map:ActiveSupport::HashWithIndifferentAccess
id: "68"
name: Club Orange
price: "2.4"
tax_rate: "21"
tax_rate: "21"
product_price: "2.4"
total_price: "2.4"
terminal_id: DellXP
time_added: "1310730896520"
serving_employee_id: "1"
synced: "true"
itemNumber: "1"
total: "2.4"
:table_id: "39"
:serving_employee_id: "1"
I recently did a fresh deploy and the data is now being stored without
the !map:ActiveSupport::HashWithIndifferentAccess part, which is
breaking my app. The serialized data is now stored as:
---
:terminal_id: DellXP
:order_data:
tableID: '1'
orderData:
items:
'0':
amount: '1'
product:
id: '7'
name: Guinness Pint
price: '3.8'
tax_rate: '21'
tax_rate: '21'
product_price: '3.8'
total_price: '3.8'
terminal_id: DellXP
time_added: '1310729775938'
serving_employee_id: '1'
synced: 'true'
itemNumber: '1'
total: '3.8'
:table_id: '1'
:serving_employee_id: '1'
which is different to the above (which actually worked for me)
I am not sure what is going on, as I am using the exact same codebase.
Anyone have any ideas?
thanks
--
Posted via http://www.ruby-forum.com/.
"Are you saying that you did a deploy that did not change a single line
of code in the entire app (and there were not changes in version of
the various gems you might use) ?"
abstract (1.0.0)
actionmailer (3.0.5)
actionpack (3.0.5)
activemodel (3.0.9, 3.0.5)
activerecord (3.0.5)
activeresource (3.0.5)
activesupport (3.0.9, 3.0.5)
annotate-models (1.0.4)
archive-tar-minitar (0.5.2)
arel (2.0.9)
builder (2.1.2)
bundler (1.0.12)
columnize (0.3.2)
daemons (1.0.10)
erubis (2.6.6)
faker (0.9.5)
gem_plugin (0.2.3)
i18n (0.5.0)
linecache19 (0.5.12, 0.5.11)
mail (2.2.19, 2.2.15)
meta_search (1.0.5)
mime-types (1.16)
mongrel (1.2.0.pre2)
mysql2 (0.2.6)
polyglot (0.3.1)
populator (1.0.0)
rack (1.2.2)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.5)
railties (3.0.5)
rake (0.8.7)
ruby-debug-base19 (0.11.25, 0.11.24)
ruby-debug-ide (0.4.16)
ruby-debug19 (0.11.6)
ruby_core_source (0.1.5, 0.1.4)
test-unit (2.3.0)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27, 0.3.25)
will_paginate (3.0.pre2)
abstract (1.0.0)
actionmailer (3.0.5)
actionpack (3.0.5)
activemodel (3.0.5)
activerecord (3.0.5)
activeresource (3.0.5)
activesupport (3.0.5)
archive-tar-minitar (0.5.2)
arel (2.0.9)
builder (2.1.2)
bundler (1.0.15)
columnize (0.3.4)
daemon_controller (0.2.6)
daemons (1.0.10)
erubis (2.6.6)
faker (0.9.5)
fastthread (1.0.7)
gem_plugin (0.2.3)
i18n (0.6.0)
linecache19 (0.5.12)
mail (2.2.19)
meta_search (1.0.5)
mime-types (1.16)
mongrel (1.2.0.pre2)
mysql2 (0.2.6)
passenger (3.0.7)
polyglot (0.3.1)
populator (1.0.0)
rack (1.2.3)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.5)
railties (3.0.5)
rake (0.9.2, 0.8.7)
rmagick (2.13.1)
ruby-debug-base19 (0.11.25)
ruby-debug19 (0.11.6)
ruby_core_source (0.1.5)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.29)
will_paginate (3.0.pre2)
bundle install --deployment
on the new machine, would that mean that it would not have specified dependencies as >= (which seems to be breaking the app as the newer gems are being downloaded and are incompatible with my code)
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/l87V_ZfOaIIJ.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
===============================================================================
via serialize :params ?
don't you have somewhere in the code this?
class HashWithIndifferentAccess < Hash
def to_yaml(opts = {})
self.to_hash.to_yaml(opts)
end
end
there could be difference between env - production/devel, try to load your app as production on your localhost
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/x8hki5-pwqEJ.
I wonder if the problem could be that "data" is a reserved word in
Rails. Using reserved words sometimes appears ok but then gives
strange problems.
See
http://oldwiki.rubyonrails.org/rails/pages/ReservedWords
Colin