Hi I have difficult times to understand why I get # instead of correct value
<%= form_tag root_url, method: :get do %> <p> <%= text_field_tag :zip_code, params[:zip_code] %> <%= submit_tag "Lookup", name: nil %> </p> <% end %> <% if @zip_code %> <dl id ="zip_info"> <dd> <%= @zip_code %> </dd> </dl> <% end %> Model:
class ZipCode < ActiveRecord::Base def initialize(zip) return zip end end Controller:
class ZipCodeLookupController < ApplicationController def index @zip_code = ZipCode.new(params[:zip_code]) #(params[:zip_code]) if params[:zip_code].present? end end
No comments:
Post a Comment