开发者

Latest Rails 3: ActionView::Template::Error (couldn't parse YAML at line 105 column 13)

I have recently encountered into a weird problem or Rails 3, possibly ever since the new rubygems 1.5 update. Basically when I deploy my program to nginx with passenger 3.0.2, I have 500 page immediately and problems like this in my production log:


ActionView::Template::Error (couldn't parse YAML at line 105 column 13):
    10: </div>
    11: <% end %>
    12: <div class="field">
    13:     <%= f.label :name %> <%= f.text_field :name %>
    14: </div>
    15: <div class="field">
    16:     <%= f.label :password %> <%= f.password_field :password %>
  app/views/sessions/new.html.erb:13:in `block in _app_views_sessions_new_html_erb___4159562374589718885_19217640_4456777064017176818'
  app/views/sessions/new.html.erb:5:in `_app_views_sessions_new_html_erb___4159562374589718885_19217640_4456777064017176818'

It looks like it's missing something in the environment and so it can't recognize all of my form_for elements. Basically the page is just a simple login page with 2 fields - name and password. This problem also ha开发者_Python百科ppens for other pages with forms, but only in production environment. In development environment, it's totally working fine. I have upgraded all my gems to the latest version, including rails 3.0.4, which however looks like not quite related to this problem. I also used to deploy the same thing onto the ubuntu on my VMware BEFORE gem 1.5, everything is still fine now, however there's no turning back for the new deployments.

I have deployed this to 2 machines running latest ubuntu, and both machine have such errors. Nginx and passenger are installed with the standard steps. Obviously with this problem the site can never run. Can anyone provide any bug fix for this? Thanks very much if you could!

PS: the login page I wrote is basically from here: http://railstutorial.org/chapters/sign-in-sign-out#top


I added the following two lines to the config/boot.rb file and the problem was solved.

require 'yaml'
YAML::ENGINE.yamler= 'syck'


I had the same problem. Actually I only needed the first line:

require 'yaml'

No need to set the YAML::Engine specifically.


For a problems with yaml syntax options like 'View/Show invisibles' in TextMate may be very helpful to locate syntax problems, yaml is very sensitive about it. In my case I just had to replace all tabs with spaces in all locale files. Also notice, if you don't have nodes with the same name on same level.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜