Reputation: 1295
I am following the Ruby on Rails Tutorial (http://ruby.railstutorial.org/chapters/a-demo-app#sec-modeling_demo_users) and successfully completed exercises up to section 2.2.1.
Now experiencing a character encoding issue when I attempt to load any of the User resources (such as localhost:3000/users and localhost:3000/user/new) created in 2.2.1, which is basically out-of-the-box code generated with:
C:\Users\Dennis\rails_projects\demo_app> rails generate scaffold User name:string email:string
My environment:
Rails returns an error page beginning with:
Encoding::InvalidByteSequenceError in Users#index
Showing C:/Users/Dennis/rails_projects/demo_app/app/views/layouts/application.html.erb where line #6 raised:
incomplete "\x00" on UTF-16LE (in C:/Users/Dennis/rails_projects/demo_app/app/assets/javascripts/users.js.coffee)
Extracted source (around line #6):
3: <head> 4: <title>DemoApp</title> 5: <%= stylesheet_link_tag "application", :media => "all" %> 6: <%= javascript_include_tag "application" %> 7: <%= csrf_meta_tags %> 8: </head> 9: <body>
Contents of users.js.coffee:
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
Contents of application.html.erb:
<!DOCTYPE html>
<html>
<head>
<title>DemoApp</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
Contents of index.html.erb:
<h1>Listing users</h1>
<table>
<tr>
<th>Name</th>
<th>Email</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td><%= link_to 'Show', user %></td>
<td><%= link_to 'Edit', edit_user_path(user) %></td>
<td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New User', new_user_path %>
Upvotes: 3
Views: 1808