⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 04 - displaying templates with render.rb

📁 O Reilly Ruby Cookbook source code
💻 RB
字号:
class ListController < ApplicationController  def index    @list = ['papaya', 'polio vaccine']    render :action => 'shopping_list'  end  def shopping_list    @list = ['cotton balls', 'amino acids', 'pie']  endend#---class ListController < ApplicationController  def index    render :action => 'shopping_list'    @budget = 87.50  end  def shopping_list    @list = ['lizard food', 'baking soda']  endend#---class ListController < ApplicationController  def index    shopping_list and render :action => 'shopping_list'    @budget = 87.50  endend#---class ListController < ApplicationController  def plain_and_fancy    render :action => 'plain_list'    render :action => 'fancy_list'  end#---class ListController < ApplicationController  def plain_or_fancy    if params[:fancy]      render :action => 'fancy_list'    else      render :action => 'plain_list'    end  endend#---class ListController < ApplicationController  def index    render :action => 'shopping_list' and return    @budget = 87.50         # This line won't be run.  endend#---

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -