Ruby on rails 3 link_to 控制器和动作 [英] Ruby on rails 3 link_to controller and action

查看:27
本文介绍了Ruby on rails 3 link_to 控制器和动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可能是一个非常简单的概念.我正在尝试创建指向控制器和操作的链接.例如,我的布局文件中有一个链接可以在单击链接时更新记录,因此我需要能够链接到控制器和操作.我将如何做到这一点?

I know this is probably a pretty simple concept. I am trying to create a link to a controller and action. For example I have a link in my layout file to update a record when a link is clicked, so I need to be able to link to the controller and action. How would I accomplish this?

推荐答案

link_to "Label", :controller => :my_controller, :action => :index

请参阅url_for.

这篇关于Ruby on rails 3 link_to 控制器和动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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