【发布时间】:2019-10-30 12:16:45
【问题描述】:
下面解释的代码出现以下错误。 “没有将 false 隐式转换为字符串”
def search_form(target, search)
raw("<span class='no_print'>" <<
form_tag('/' + target + '/', :method => :get) <<
text_field_tag(:search, search) <<
submit_tag('Search', data: { disable_with: "Searching..." }) <<
!search.nil? ? link_to('Clear', root_path, class: 'clearingLink') : "" <<
'</form>' <<
'</span>' <<
form_focus('search'))
end
!search.nil? ? link_to('Clear', root_path, class: 'clearingLink') : "" <<
This is the line I have added recently. Can anyone please let me know what is the wrong with this ?
【问题讨论】:
-
你用
ruby-on-rails标记了你的问题我想知道你为什么通过字符串连接构建HTML sn-p而不使用视图? -
嘿。此代码 sn-p 已添加到控制器本身中。我得到了这个项目的工作....
标签: ruby-on-rails ruby