不,这应该是
class ControllerNameController < ApplicationController
def index
render :partial=>'index'
end
end
编辑:详细解释我的答案-
当你写一个方法
method_name
而你却不
render
(
redirect_to
)任何情况下,控制器都会查找页面
method_name.html.erb
默认情况下。
然而,使用
render :partial
如下图所示,操作将改为使用分部。
例如
class ControllerNameController < ApplicationController
def some_method_name
render :partial=>'index'
end
end
class ControllerNameController < ApplicationController
def some_method_name
render :action=>'index'
end
end
class ControllerNameController < ApplicationController
def some_method_name
end
end