imho, untuk update: @user = User.find(params[:id]) @user.first_name = "Nizham" @user.last_name = "Tanjung" if @user.save .....
Tapi (demi simplicity 'n malesity), kenapa nggak pake ./script generate scaffold ajah? kan udah otomatis CRUD nya. ----- Original Message ---- From: d0a98042 <[EMAIL PROTECTED]> To: id-ruby@yahoogroups.com Sent: Friday, May 9, 2008 10:25:12 AM Subject: [id-ruby] Re: [Rails] Masalah dengan 1 form yang menambah row di 2 tabel Memang desain table dimasalah saya redundant, tapi ini cuma test case yang saya coba selesaikan. Masalah saya kemarin mungkin banyakj ditemui sama rails-noob macam saya :) Solusinya jadi gini : class Address < ActiveRecord: :Base has_one :province belongs_to :user ... class Province < ActiveRecord: :Base belongs_to :country belongs_to :address ... class User < ActiveRecord: :Base has_one :address, :dependent => :destroy ... class UserController < ApplicationControll er ... def create @user = User.new(params[ :user]) @address = @user.create_ address(params[ :address] ) if @user.save redirect_to :action => 'list' else render :action => 'new' end end ... sekarang masalahnya kalo mau update gmn? :( tolongin yah ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ [Non-text portions of this message have been removed]