Halo semua..saya lagi belajar Rails dan masalah dikit. Mohon bantuan teman2.
Saya punya tabel users dan addresses. 1 user hanya punya 1 address. di models/user.rb class User < ActiveRecord::Base has_one :address validates_presence_of :username, :firstname, :passwd, :message => "can't empty"; validates_format_of :email, :with => /\A([EMAIL PROTECTED])@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i validates_confirmation_of :passwd enddi models/address.rb class Address < ActiveRecord::Base has_many :province belongs_to :user enddi views/user/new.rb (sebagian), form ini akan post ke user/create ... <div> <label for="user_gender">Gender</label> <%= select :user, :gender, {"Male" => "m", "Female" => "f"} -%> </div> <div> <label for="user_birthdate">Birth date</label> <%= date_select :user, :birthdate, :order => [:day, :month, :year], :include_blank => true -%> </div> <div> <label for="address_name">Address</label> <%= text_area :address, :name, :size => "35x5" -%> <%= error_message_on 'address', 'name' -%> </div> <div> <label for="address_city">City</label> <%= text_field :address, :city, :size => 20 -%> </div> ... di controllers/user def create @user = User.new(params[:user]) if @user.save @user.address.create(params[:address]) redirect_to :action => 'list' else render :action => 'new' end endwaktu saya coba, row di table user memang bertambah tapi di table address tidak, saya dapat error The error occurred while evaluating nil.createdari error tersebut saya rasa ada kesalah di @user.address.create(params[:address])tapi saya ga tau harus gmn lagi. mohon pencerahan teman-teman. Trims. [Non-text portions of this message have been removed]