在RoR 3中,我只想拥有一个链接/按钮来激活控制器中的某些操作/方法.具体来说,如果我点击页面上的"update_specs"链接,它应该转到我的产品控制器中的"update_specs"方法.我在这个网站上找到了建议:
link_to "Update Specs", :controller => :products, :action => :update_specs
Run Code Online (Sandbox Code Playgroud)
但是,当我点击此链接时,我收到以下路由错误:
路由错误没有路由匹配{:action =>"update_specs",:controller =>"products"}
我已经阅读了路由但我不明白为什么如果可以通过资源访问所有其他方法,我必须路由此方法:产品.
model-view-controller controller ruby-on-rails rails-routing
我正在尝试使用 SSH 端口转发来保护/加密我的 VNC 连接(个人计算机到 linux/ubuntu 服务器)以保护连接:
ssh -L 5901:localhost:5901 joe@laptop
Run Code Online (Sandbox Code Playgroud)
这是来自: https: //help.ubuntu.com/community/VNC#port-forwarding
因此,我从我的个人计算机向 Linux 服务器输入此命令,然后我就可以使用 ssh 进行连接,就像登录一样。看起来成功了。
但是,当我通过 VNC(使用 RealVNC)连接到 Linux 服务器时,它仍然警告我的连接未加密。我的路由器上有端口转发端口 5901 和 22 到我的本地计算机。
我缺少什么?
注1:我目前使用RealVNC(免费版本)和tightvncserver(在linux/ubuntu服务器上)。
注2:我使用本指南来寻找获得安全 VNC 连接的方法: https: //help.ubuntu.com/community/VNC/Servers
在Ruby中必须有一种更有效的方法.我有一个方法列表,可以在多个站点中搜索相同的内容(标题,价格),但根据每个商店中的代码略有不同.例如:
def store1_get_title
def store1_get_price
def store2_get_title
def store2_get_price
def store3_get_title
def store3_get_price
Run Code Online (Sandbox Code Playgroud)
当调用所有这些函数时,我只想要一个带有"namespace"参数的泛型调用来调用这些方法中的任何一个,而不必输入所有这些,例如:
for get_all_stores().each do |store|
store::get_title
store::get_price
end
Run Code Online (Sandbox Code Playgroud)
...会像我想的那样调用store1_get_title,store1_get_price,store2_get_title,store2_get_price.有这样的事情或更好的方法吗?
希望有道理.感谢您的任何意见!
编辑:这些任务是在rake任务代码中.
arguments ×1
controller ×1
encryption ×1
methods ×1
namespaces ×1
rake-task ×1
ruby ×1
ssh ×1
vnc ×1
vnc-server ×1