RoutingError inside an iFrame

痴心易碎 提交于 2019-12-09 03:52:52

问题


I scaffolded a test app and got a Routing error when I put an iFrame inside my view:

This is the show template where I added the iFrame:

views/bars/show.html.erb:

<p>
  <b>Body:</b>
  <%=h @bar.body %>
</p>

<iframe src=“http://www.yahoo.com” style=“width:500px; height:500px;” frameborder=“0?></iframe>


<%= link_to 'Edit', edit_bar_path(@bar) %> |
<%= link_to 'Back', bars_path %>

I'm calling the page like this:

http://localhost:3000/bars/1

The page displays correctly. But the iFrame inside the page says this:

Routing Error

No route matches "/bars/%E2%80%9Chttp://www.yahoo.com%E2%80%9D" 
with {:method=>:get}

I didn't make any changes to routes.rb from the defaults:

ActionController::Routing::Routes.draw do |map|
  map.resources :bars
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

回答1:


You're not using the right double quote character, which is "



来源:https://stackoverflow.com/questions/1494065/routingerror-inside-an-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!