On Mon, 23 Feb 2009 12:31:15 +0100
Hello Guy <[email protected]> wrote:
> Hallo,
hi,
> ich habe eine klasse Patient. Ich möchte Daten der Patienten aus der
> Datenbank
> holen.
> Ich stelle mir das so vor: Patient(mueller) => ausgewählte Daten (nicht
> alle) wie Name, Geburtsdatum und Adresse werden geholt.
>
> Wie kann ich diese Situation in Ruby realisieren?
also mit ActiveRecord etwa so:
class Patient < ActiveRecord::Base
composed_of :address_data, :mapping => [ %w(lastname lastname),
%w(geburtsdatum geburtsdatum),
%w(strasse strasse),
%w(stadt stadt)]
end
data = Person.find(:first).address_data
data.strasse
das schafft dir ein 'subset' an daten der Patient-class
natuerlich muessen diese attribute auch in der Patient-class vorhanden
sein.
sieh dir das an:
http://api.rubyonrails.org/classes/ActiveRecord/Aggregations/ClassMethods.html
gruesse
rene
>
> lg
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rubyonrails-ug mailing list
> [email protected]
> http://mailman.headflash.com/listinfo/rubyonrails-ug
--
take care not to get sucked into /dev/null
gpg --recv-keys 0F8DDFBB
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug