On 23 Jan 2008, at 10:57, David De vits wrote:
>
> Hello,
> I have a class Person
> class Persoon < ActiveRecord::Base
>   set_table_name "Persoon"
>   set_primary_key "p_persoon"
>   has_many :adres, :class_name => "Adres"
>   composed_of :name, :class_name => Name, :mapping => [
[:naam,:naam],
> [:voornaam,:voornaam], [:voornaam2,:voornaam2],
> [:persnickname,:persnickname], [:perssortname,:perssortname] ]
>
>  def somemethod(string)
>    ...
>  end
> end
>
> and a child class Student (which is a person)
> class Student < Person
>   set_table_name "Student"
>   set_primary_key "p_persoon"
>   has_many :contract, :foreign_key => ''p_persoon''
> end
>
> How can i access my Persons attributes when i have a Student object ?
> like this
> @student=student.new
> puts student.somemethod (=> undefined method)
> puts student.name.naam  (which is just empty)
>
> If i make a method in Student
> def somemethod(string)
>    super
> end
> i get a stack level to deep error
ActiveRecord only support single table inheritance (ie not what you''re
doing here).
Fred
>
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---