address_controller.rb

来自「ajax修炼之道源代码。很难下到的。现在奉献给大家。」· RB 代码 · 共 84 行

RB
84
字号
#---# 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 + =
减小字号Ctrl + -
显示快捷键?