【发布时间】:2013-09-30 05:31:08
【问题描述】:
^[[1;31m./app/views/sources/_form.html.erb:136 - 用局部变量替换实例变量^[[0m ^[[1;31m./app/views/sources/_form.html.erb:138 - 用局部变量替换实例变量^[[0m
这到底是什么意思?消除此警告的程序是什么?
<div id="book-container">
<label class="control-label" style="width: auto; font-weight:bold;">"selected books<span class="
red-star"> *</span></label>
<div "book-container">
<% if @chapter.nil? %>
<%= select_tag('book_ids',
options_for_select(@books.collect { |s| [s.name, s.id, {title: s.name}] }, params[:book_ids]),
{multiple: true, prompt: "hello:", style: "width: auto;",
data: {'multiselect-opts' => {height: '400px'}}}) %>
<% else %>
<% selected_books = @chapter.get_selected_books %>
<%= select_tag('book_ids',
options_for_select(@books.collect { |s| [s.name, s.id, {title: s.name}] }, selected_books),
{multiple: true, prompt: "Hello", style: "width: auto;",
data: {'multiselect-opts' => {height: '400px'}}}) %>
<% end %>
【问题讨论】:
-
您能告诉我们生成此错误消息的模板的代码吗?
-
使用 Rails 最佳实践获取这些消息。
-
您仍然需要向我们展示上面错误消息中列出的模板代码。
-
已为第 136 行和第 138 行添加代码。
-
/app/views/ad_sources/_form.html.erb:47 看起来该错误的第一个实例在第 47 行另外 - 你需要告诉我哪一行是 136 :)
标签: javascript html ruby-on-rails ruby ruby-on-rails-3