Yaml::load_file acting different between development and production (Rails)

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-03-22T06:39:10Z Indexed on 2010/03/22 6:41 UTC
Read the original article Hit count: 349

Filed under:
|
|

Hi,

I am completely stumped at the nature of this problem.

We export data from our application into a 'cleaned' YAML file (stripping out IDs, created_at etc). Then we (will) allow users to import these files back into the application - it is the import that is completely bugging me out.

In development, YAML::load_file(params[:uploaded_data].local_path) returns an array of YAML::Objects's (and it doesn't matter which of the number of different ways the file could be loaded):

[#{"exception_count"=>"0", "title"=>"Start", "amount"=>"70.00", "colour"=>nil, "repeat_type_id"=>"0", "repeat_interval"=>"1"}}>, etc etc]

Which is very nice, as the attributes also include the (associated model) exceptions that you see an exception_count for.

However on production (rails 2.3.2, running REE 1.8.7 and 1.8.6 for testing, tested on two different production env's, and running production locally) it returns an array of the Objects within the YAML - in this case, Event:

[#, repeat_type_id: 0, colour: nil, repeat_interval: 1, exception_count: 0>, etc etc]

Now this would be just perplexing if it also included the associated model Exception with it - however it doesn't.

Can anyone at all shed some light on why the Yaml parser would behave so differently between production and development?

I'm on rails 2.3.2, running REE 1.8.7; however I've also tested running Ruby 1.8.6 with exactly the same results.

Thanks for any help!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby