http://api.rubyonrails.com/classes/ActiveRecord/Aggregations/ClassMethods.html can someone in the know send me a quick listing of the backend sql for example on the above url... thanks in advance... _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
class Customer < ActiveRecord::Base composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) composed_of :address, :mapping => [ %w(address_street street), %w(address_city city) ] end There is nothing out of usual in the generated SQL. Composed_of changes only how record attributes can be reached on the ruby side. For example DB defines field balance as string, hoverer Ruby converts them to value objects of type Money. Also address_street and address_city are strings in db schema, however on the Ruby side a virtual field address will have the class Address. It''s mostly syntactic sugar that will ease record manipulation on the Ruby side. Cheers, Zsombor On 5/6/05, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org> wrote:> http://api.rubyonrails.com/classes/ActiveRecord/Aggregations/ClassMethods.html > > can someone in the know send me a quick listing of the backend sql for > example > on the above url... > > thanks in advance... > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-- http://deezsombor.blogspot.com
so those fields are all in one table... can you composed of to join? Dee Zsombor wrote:>class Customer < ActiveRecord::Base > composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) > composed_of :address, :mapping => [ %w(address_street street), >%w(address_city city) ] >end > >There is nothing out of usual in the generated SQL. Composed_of >changes only how record attributes can be reached on the ruby side. >For example DB defines field balance as string, hoverer Ruby converts >them to value objects of type Money. Also address_street and >address_city are strings in db schema, however on the Ruby side a >virtual field address will have the class Address. > >It''s mostly syntactic sugar that will ease record manipulation on the Ruby side. > >Cheers, >Zsombor > > >On 5/6/05, Sean T Allen <sean-5W9FBhQXBOtBDgjK7y7TUQ@public.gmane.org> wrote: > > >>http://api.rubyonrails.com/classes/ActiveRecord/Aggregations/ClassMethods.html >> >>can someone in the know send me a quick listing of the backend sql for >>example >>on the above url... >> >>thanks in advance... >> >> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> >> >> > > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 07/05/2005, at 2:58 AM, Sean T Allen wrote:> so those fields are all in one table... > > can you composed of to join?It''s called: has_one. If you''d like to cascade delete''s across the association use then '':dependent => true'' option. - tim lucas
Tim Lucas wrote:> On 07/05/2005, at 2:58 AM, Sean T Allen wrote: > >> so those fields are all in one table... >> >> can you composed of to join? > > > It''s called: has_one. > > If you''d like to cascade delete''s across the association use then > '':dependent => true'' option. > > - tim lucasbut if is a has_one its no longer a composed of right? i guess my question can best be wrapped up as... a composed of relatiobship works on 1 sql table correct? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails