@@The ERROR: You have a nil object when you didn't expect it! The error occurred while evaluating nil.ip ------------------------------------------------------------------- @@The FORM:

Contact Us

<%= flash[:notice] %> <% form_tag :controller=>"contacts", :action=>"create" do %>
Name: <%= text_field 'contact', 'name', "size"=>20 %>
Email: <%= text_field 'contact', 'email', "size"=>20 %>
URL: <%= text_field 'contact', 'website', "size"=>20 %>
Subject: <%= text_field 'contact', 'subject', "size"=>20 %>
<%= text_area 'contact', 'data' %>
<%= submit_tag "Submit" %>
<% end %>
------------------------------------------------------------------- @@controllers/ContactsController.rhtml def create @contact = Contact.new(params[:contact]) @contact.ip = @request.env['REMOTE_ADDR'] @contact.update_attributes(params[:contact]) if @contact.save flash[:notice] = 'Your message was successfully sent.' #Send an email Notifier.deliver_contact_new(@contact) redirect_to :controller=>'information', :action => 'contactUs' else render :action => 'new' end end models/notifier.rb class Notifier < ActionMailer::Base def contact_new(contact) subject = "You have received a new message" recipients = 'jonathan@greatjobsofchina.com' from = 'mail-noreply@greatjobsofchina.com' body :info => @contact end end ------------------------------------------------------------------- notifier/contact_new.rhtml From: Subject: Date: URL: IP: <%= @info.ip %> ---------------------------------------------------------------------