So, this project was built with ruby 1.8.7, rails 2.3.18 and mysql database during early 2010s. After upgrading to ruby 1.9.3 and mysql 8, the project throw the error mentioned in the title. Along with Psych::Syntax error it says,
(<unknown>): did not find expected node content while parsing a flow node at line 13 column 14
Now the interesting thing is that if I comment out the 13th line in config/locales/sv.yml, which is used for translation, the project runs successfully. I'm currently in dark on how or why it is working. Here is the first 23 lines of sv.yml.
1 "sv":
2 date:
3 formats:
4 default: "%d.%m.%Y"
5 short: "%e. %b"
6 long: "%e. %B %Y"
7 only_day: "%e"
8
9 day_names: [Söndag, Måndag, Tisdag, Onsdag, Torsdag, Fredag, Lördag]
10 abbr_day_names: [Sön, Mån, Tis, Ons, Tor, Fre, Lör]
11 month_names: [~, Januari, Februari, Mars, April, Maj, Juni, Juli, Augusti, September, Oktober, November, December]
12 abbr_month_names: [~, Jan, Feb, Mar, Apr, Maj, Jun, Jul, Aug, Sep, Okt, Nov, Dec]
13 order: [:year, :month, :date]
14
15 time:
16 formats:
17 default: "%A, %e. %B %Y, %H:%M Uhr"
18 time: "%H:%M"
19 short: "%e. %B, %H:%M Uhr"
20 long: "%A, %e. %B %Y, %H:%M Uhr"
21 only_second: "%S"
22 am: ""
23 pm: ""
Here is the index
function from ../app/controllers/home_controller.rb file, where the error starts according to application trace.
def index
render "index#{params[:v]}"
end
Here is what the application trace says:
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/psych.rb:203:in `parse'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/psych.rb:151:in `parse'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/psych.rb:127:in `load'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb:227:in `load_yml'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb:214:in `load_file'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb:21:in `block in load_translations'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb:21:in `each'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n/backend/base.rb:21:in `load_translations'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n/backend/simple.rb:57:in `init_translations'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n/backend/simple.rb:40:in `available_locales'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n/config.rb:38:in `available_locales'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/vendor/i18n-0.4.1/i18n.rb:35:in `available_locales'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/template.rb:226:in `valid_locale?'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/template.rb:243:in `parse_extensions'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/template.rb:233:in `split'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/template.rb:118:in `initialize'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/reloadable_template.rb:81:in `initialize'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/reloadable_template.rb:38:in `new'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/reloadable_template.rb:38:in `register_template_from_file'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/reloadable_template.rb:62:in `block in load_all_templates_from_dir'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/reloadable_template.rb:62:in `each'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/reloadable_template.rb:62:in `load_all_templates_from_dir'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/reloadable_template.rb:29:in `[]'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/paths.rb:48:in `block in find_template'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/paths.rb:47:in `each'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_view/paths.rb:47:in `find_template'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_controller/base.rb:1391:in `default_template'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_controller/layout.rb:265:in `candidate_for_layout?'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_controller/layout.rb:245:in `pick_layout'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_controller/base.rb:915:in `render'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_controller/benchmarking.rb:51:in `block in render_with_benchmark'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/core_ext/benchmark.rb:17:in `block in ms'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/activesupport-2.3.18/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/home/../.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/actionpack-2.3.18/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'
/home/../project/app/controllers/home_controller.rb:17:in `index'
Another interesting thing that i failed to reproduce is that if I comment out the 13th line when the server is running, sometimes it points to 98th line of a view file citing the same error. The code is as follows in ../app/view/event/partials/_event_details_form.html.haml
95 %p.field#start_time
96 = f.label :start_time, "%s: " % ["Start time"[:event_start_time]]
97 - # TODO: Switch to jQuery-UI Datepicker f.text_field :start_time, :value => f.object.start_time.to_s.split(" ").first
98 = date_picker f, :start_time
99 -# DISABLED: %strong= link_to "Hide"[:event_start_time_hide], 'javascript: return false;', :id => 'hide-start_time'
100 - # %span.hint= "Event starts at?"
101
102 - if f.object.start_time.present?
103 :javascript
104 $j(function() {
105 $j("#start_time").show();
106 $j("#show-start_time").hide();
107 });
108 - else
109 :javascript
110 $j(function() {
111 $j("#start_time").hide();
112 $j("#show-start_time").show();
113 });
I'm suspecting the order
in 13th line of sv.yml has something to do with date_picker
in 98th line in _event_details_form.html.haml.
Also, the date picker function is as follows,
$j.datepicker.setDefaults($.datepicker.regional['sv']);
$j("#event_start_time").datepicker({
dateFormat: "yy-mm-dd",
autoSize: true,
buttonImage: '/images/datepicker.gif'
});
You can't use colons in your "order" array. If you really need the colons, you have to wrap each item of the array with quotation marks.
13 order: [':year', ':month', ':date']