rails 3 渲染视图没有动作 [英] rails 3 rendering view without action

查看:46
本文介绍了rails 3 渲染视图没有动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为特定操作定义了路由并创建了一个链接.我也创建了相应的视图,但没有代码定义控制器操作方法.单击链接时仍会呈现视图.也就是说,在没有实际存在动作的情况下呈现视图.

I defined the routes for a particular action and created a link. I created the corresponding views too but did not code define the controller action method. Still the view is rendered on clicking the link. That is the view is rendered without the action actually being present.

有什么解释吗?

推荐答案

是的,即使没有相应的动作,视图也会被渲染,它会像为相同的路由定义一样工作.但这不是一个好习惯!

Yes, the view will be rendered even if no corresponding action is present, it will work as routes are defined for the same. But this is not a good practice!

这篇关于rails 3 渲染视图没有动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆