Comments (20)
Thanks for the bug report! Would you mind filing this bug on redmine:
http://redmine.ruby-lang.org/projects/ruby-19/issues?set_filter=1&tracker_id=1
I can fix this, but if it's not on redmine, I'm afraid it won't get backported to 1.9.2.
from psych.
Ok, done.
http://redmine.ruby-lang.org/issues/show/4300
from psych.
Awesome, thank you!
from psych.
Is there a way to upgrade Psych for 1.9.2-p136? p180 seems to use RubyGems 1.5 and that is not compatible with Ruby on Rails 2.3.
from psych.
A follow-up: his patch isn't in 1.9.2-p180. The only way to get it for Ruby on Rails 2.3 is to use HEAD and downgrade RubyGems to 1.3.7.
Lets just say that virtually every Ruby (and especially Ruby on Rails) app I have seen since 2005 that runs in multiple environments, relies on this feature of YAML :(
from psych.
For now, I suggest you downgrade to use Syck. The way to do that is add this to your environment.rb:
YAML::ENGINE.yamler = 'syck'
I am thinking of releasing psych as a gem, but it must be 1.9 only. :-(
from psych.
So it is possible to switch back to Syck. Great, thank you. I personally think that 1.9-only version of Psych is totally fine: on 1.8, people seem to be pretty happy with Syck.
from psych.
The annoying thing is that even if I release a gem, you would be forced to say:
gem 'psych'
in your environment.rb. Otherwise the stdlib one would be required. Either I can teach people how to downgrade to syck, or teach people to install a gem, then add a special command to require it. I'm not sure which is least annoying. :-(
from psych.
I vote for the gem - the reason I want to try psych is that I frequently segfault in syck when running our test cases with complex VCR yaml fixtures.
from psych.
Fixed in ruby trunk, so I'm closing. Also, I've released a gem that is 1.9 only.
from psych.
@tenderlove, are there any plans to backport this to the next point release of 1.9.2? I see people hitting this issue over and over, including well-known folks in the Ruby community. That's kinda sad.
from psych.
@michaelklishin there is a ticket filed to backport to 1.9.2. In the mean time (as I have mentioned in the previous comments) please use the gem or downgrade to syck.
from psych.
actually, better add to application.rb, not environment.rb
otherwise rake tasks that do not load environment won't fire O_O (e.q. drop/create DB)
from psych.
@tenderlove: What version of the Psych gem has this fixed? I get the problem with Psych 1.2.0 still.
from psych.
This is still an issue, and I'm having to fix every Rails app I run on 1.9.2 with this code in config/boot.rb
:
if RUBY_VERSION.to_f >= 1.9
# The psych engine for YAML doesn't handle `<<: *defaults` properly.
# See: https://github.com/tenderlove/psych/issues/8
require 'yaml'
YAML::ENGINE.yamler = 'syck'
end
It would be great if this hack was no longer necessary.
from psych.
@ndbroadbent please open a new ticket. In the new ticket, post code that parses your YAML file using 1.8 and 1.9 (with psych). Post the output for 1.8 and the output for 1.9, and we can get it fixed. Thanks.
from psych.
Also make sure to include the YAML file along with your sample program. Thanks!
from psych.
Aha! I see that it has been fixed in 1.9.2-p290, but not 1.9.2-p180.
I shall bring all my Rails 3 apps up to p290.
Sorry for the false alarm.
from psych.
Sorry but it still not merging keys correctly as of Ruby 1.9.3p374 and Rails 3.2.11 rails/rails#9025
# Models
ru:
activerecord:
attributes:
model:
title: "Russian title"
errors: &errors
format: ! '%{attribute} %{message}'
messages:
accepted: нужно подтвердить
activerecord:
errors:
<<: *errors
Start console:
I18n.locale=:ru
Model.human_attribute_name(:title)
=> "Title"
from psych.
I know it is veryyyyy old thread. But I started using/learning Ruby just now :-). As per the thread the merge issue is fixed; but I can see that the merge is working correctly only on single level. It is not working if the properties grows to multiple level. For example,
common: &common
api_services:
host: host1.com
port: 8080
development:
<<: *common
api_services:
host: host2.com
So when I access "development.api_services.port" should return "8080", but returning "nil". Is it expected behavior?
I can see the code changes for this merge on "to_ruby.rb" under revive_hash.
Rather than just assigning the value in the else part
hash[key] = val
how about merging it with existing values?
if hash[key] && hash[key].class == Hash
hash[key].deep_merge(val)
else
hash[key] = val
end
from psych.
Related Issues (20)
- Error loading Psych gem specification on Ruby 3.2.2 HOT 1
- YAML string in exponential format cannot be loaded by YAML 1.2 parser
- Psych::BadAlias error with simple alias HOT 1
- Version 4.0.5 breaks Date deserialization HOT 1
- JSON is invalid
- Dates with five digit years throw exception HOT 1
- Prevent snakeYAML add backslash when dump multiple line string HOT 1
- YAML.dump(date) generates warnings with Rails 7.0.7+ HOT 1
- [DOC] Link fragment does not work
- YAML 1.2 compliance possibly breaking VCR HOT 3
- Add settings for alias limits, recursion, and duplicate keys HOT 8
- TypeError: allocator undefined for Nokogiri::HTML5::Document on YAML.unsafe_load_file HOT 3
- Psych 5.1.1 fails to load on JRuby 9.x HOT 10
- Singleton Classes Aren't round-trippable
- Issue between psych and mini_racer on platform x86_64-linux HOT 1
- Psych::DisallowedClass when loading fixtures HOT 3
- Strange `FrozenError` on `Psych.load` HOT 1
- Kernel.y interferes with code relying on method_missing HOT 3
- SSL issues preventing installation HOT 1
- yaml parsing is wrong when key's value has leading colon HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psych.