嗨,这是我在 HAML 中的 form_tag,当我将其转换为 erb 时出现错误,
%h2 Create New Movie
= form_tag movies_path, :method => :post do
= label :movie, :title, 'Title'
= text_field :movie, :title
= label :movie, :rating, 'Rating'
= select :movie, :rating, ['G','PG','PG-13','R','NC-17']
= label :movie, :release_date, 'Released On'
= date_select :movie, :release_date
= submit_tag 'Save Changes'
下面是我的erb,
<h2> Create New Movie </h2>
<form action = <%= "#{movies_path}"%> method = "post">
<%= label :movie, :title, 'Title' %>
<%= text_field :movie, :title %>
<%= label :movie, :rating, 'Rating' %>
<%= select :movie, :rating, ['G','PG','PG-13','R','NC-17'] %>
<%= label :movie, :release_date, 'Released On' %>
<%= date_select :movie, :release_date %>
<%= submit_tag 'Save Changes' %>
</form>
我在第 12 行附近收到“无法将符号转换为字符串”。