I want to use xml soap later but at first I am trying to just get an input from input and send it to model via controller. I have difficult time to get this first step done. here are my code:
View (index.html.erb)
<%= form_tag(:controller => "zip_code_lookup", :action => 'index') do %> <%= text_field_tag :zip_code, params[:zip_code] %> <%= submit_tag("go") %> <% end %> <h3>Displaying: <%= @zip_code %></h3>
Controller
class ZipCodeLookupController < ApplicationController def index @zip_code = ZipCode.initialize(@zip_code) end end
Model:
class ZipCode < ActiveRecord::Base def self.initialize(zip) return zip end end
No comments:
Post a Comment