l18n :: InvalidLocaleData Rails

时间:2015-01-19 17:04:43

标签: ruby ruby-on-rails-4

点击网址http://localhost:3000/articles/new/时出错。

显示c:/Sites/blog/app/views/articles/new.html.erb第8行:

无法从C加载翻译:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/locale/en.yml:期望它返回哈希,但不是

档案blog.html.erp

 <h1>New article</h1> 


<%= form_for :article do |f| %>
  <p>
    <%= f.label :title%><br>
    <%= f.text_field :title %>
  </p>

  <p>
    <%= f.label :text%><br>
    <%= f.text_area :text %>
  </p>

  <p>
    <%= f.submit %>
  </p>
<% end %>

控制器文章行动新。

class ArticlesController < ApplicationController
  def new
  end
end

文件config / routes.rb

Rails.application.routes.draw do
  resource :articles
  get 'welcome/index'

Rails 4.1.8 Ruby 2.1.5 Winddows 7

1 个答案:

答案 0 :(得分:0)

删除所有文件C:\ RailsInstaller \ Ruby2.1.0 \ lib \ ruby​​ \ gems \ 2.1.0 \ gems \ activesupport-4.1.8 \ lib \ active_support \ locale \ en.yml put - en: