我有this。
我在哪里可以找到config/routes.rb
以及如何在Rhomobile中使用ApplicationController
?
如何将视图添加到现有的rhomobile控制器?
有可能吗?
答案 0 :(得分:0)
config / routes.rb 。如果我没有错,那么它就存在于轨道中。
其次,“application.rb”与Rhomobile中的“ApplicationController”类似。
如果您想要向现有模型添加新视图,只需将新方法(def)添加到控制器(.rb)和新视图(.erb)中,其名称与新方法相同。 / p>
假设在app / Demo中存在一个模型DemoController.rb。您可以像
一样添加新方法class DemoController < Rho::RhoController
...
def index
end
def new_method
end
end
要从索引视图导航到new_method,您可以编写
<button onclick="location.href='/app/Demo/new_method'">new method</button>
或
<button onclick="location.href='<%= url_for :action => :new_method %>'"
>new method</button>