2010年11月15日 星期一

create redirect function to another page

1.user rediect_to functon on controller
#vim /cms/app/controller/demo_controller.rb

def index2
redirect_to(:action=>'say_Hello')
end

def index3
redirect_to('http://tw.yahoo.com')
end

def say_Hello
render(:text=>'welcome to use ruby on rails')
end

2.add say_Hello.html.rb on view page
add new line in it
<%=text %>

沒有留言:

張貼留言