I feel a bit stupid but this is not working (and I expected it should work):
class MembershipCard < ActiveRecord::Base
belongs_to :association
belongs_to :personal_record
validates :number, :presence => true
def dis
print "---------------------------- #{personal_record.as_json}---------------------"
number
end
def value
id
end
end
class PersonalRecord < ActiveRecord::Base
has_many :membership_card, :dependent => :nullify
def dis
"#{name} #{surname}"
end
def val
id
end
end
print "---------------------------- #{personal_record.as_json}---------------------"
It's not printing. Any suggestion about why this is happening?
I can't access any associated model in this way and it's a disaster, basically I can't use activerecord.