chen ge
2006-May-24 15:03 UTC
[Rails] where can i find a good tutorial for has_one and belongs_to?
thanks for helps! -- Posted via http://www.ruby-forum.com/.
paolo maldini
2006-May-24 15:27 UTC
[Rails] Re: where can i find a good tutorial for has_one and belongs
http://blog.invisible.ch/files/rails-reference-1.1.pdf chapter 3 -- Posted via http://www.ruby-forum.com/.
chen ge
2006-May-24 16:37 UTC
[Rails] Re: where can i find a good tutorial for has_one and belongs
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
--
Posted via http://www.ruby-forum.com/.
Conrad Taylor
2006-May-24 17:59 UTC
[Rails] where can i find a good tutorial for has_one and belongs_to?
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 5/24/06, chen ge <chenge2k@gmail.com> wrote:> > thanks for helps! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060524/b65ead41/attachment-0001.html
Warren Noronha
2006-May-25 12:26 UTC
[Rails] where can i find a good tutorial for has_one and belongs_to?
On May 24, 2006, at 8:33 PM, chen ge wrote:> thanks for helps!http://www.hyperionreactor.net/node/60 Warren
Justin Forder
2006-May-27 00:06 UTC
[Rails] Re: where can i find a good tutorial for has_one and belongs
chen ge wrote:> 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?That''s what script/console is for - it''s extremely useful. regards Justin