test_controller.rb
来自「基于ruby的进阶编程,大家可以对照教材<<Ruby on Rail」· RB 代码 · 共 34 行
RB
34 行
class TestController < ApplicationController
def index
render :text => 'Hello, World'
end
def test_action
render(:action => :index)
end
def test_template
render(:template => "test/index")
end
def test_file_1
render (:file => "F:/Project/RoR/test/app/views/test/index.rhtml")
end
def test_file_2
render (:file => "test/index", :use_full_path => true)
end
def test_nothing
render(:nothing => true)
end
def test_inline
render :inline => "<%= 'Hello ' + word %>", :locals => { :word => "World" } , :type => "rhtml"
end
#~ def test_partial
#~ render :partial => "test"
#~ end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?