thanks for helps!
thanks.
i want to know if i can test these associations in a standalone rb
file(without webrick), i tried and it didn’t work.
i use:
require ‘rubygems’
require_gem ‘activerecord’
ActiveRecord::Base.establish_connection(
:adapter => ‘mysql’,
:socket=>‘/var/run/mysqld/mysqld.sock’,
:host => ‘localhost’,
:username => ‘root’,
:password => ‘’,
:database => ‘db1’
)
class Order < ActiveRecord::Base
has_one :Item
end
class Item < ActiveRecord::Base
belongs_to :Order
end
…
order.item =item
…
it told me ‘item=’ not defined.
must i test under the support of webrick or script/console?
paolo maldini wrote:
http://blog.invisible.ch/files/rails-reference-1.1.pdf
chapter 3
Hey Chen, I would recommend going through the following at:
**http://developer.apple.com/tools/rubyonrails.html
BTW, it doesn’t cover ‘has_one’ but it uses the ‘has_many’.
In addition to that it covers the following:
- belongs_to
- migrations
Peace,
-Conrad
On May 24, 2006, at 8:33 PM, chen ge wrote:
thanks for helps!
Warren
chen ge wrote:
ActiveRecord::Base.establish_connection(
endmust i test under the support of webrick or script/console?
That’s what script/console is for - it’s extremely useful.
regards
Justin