📄 address_controller.rb
字号:
#---# Excerpted from "Pragmatic Ajax"# We make no guarantees that this code is fit for any purpose. # Visit http://www.pragmaticprogrammer.com/titles/ajax for more book information.#---class AddressController < ApplicationController def edit_no_ajax end def edit @page_title = "Edit Address" end def edit_whole_form end def edit_parse_data end def edit_jsonrpc end def show end def get_city_state zip = @params[:zip] if(zip == '90210') render(:text => 'Beverly Hills,CA') else render(:text => 'Durham,NC') end end def edit_auto_complete end def get_zips @orig = ['11111', '11222', '13444', '13555', '13556', '13557', '22222', '23333', '23444'] zip = @params[:address][:zip] @zips = @orig.select {|z| z.starts_with?(zip)} end def get_city_state_whole_form @zip = @params[:zip] if(@zip=='90210') @city = "Beverly Hills" @state = "CA" else @city = "Durham" @state = "NC" end end def get_city_state_parse_data zip = @params[:zip] if(zip == '90210') @city = 'Beverly Hills' @state = 'CA' else @city = 'Durham' @state = 'NC' end end end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -