[MacRuby-devel] [MacRuby] #507: valueForKey(key) no longer working with NSManagedObject subclasses.

MacRuby ruby-noreply at macosforge.org
Mon Apr 19 17:51:12 PDT 2010


#507: valueForKey(key) no longer working with NSManagedObject subclasses.
-----------------------------------+----------------------------------------
 Reporter:  johnmacshea@…          |       Owner:  lsansonetti@…              
     Type:  defect                 |      Status:  new                        
 Priority:  major                  |   Milestone:                             
Component:  MacRuby                |    Keywords:  valueForKey, KVC, Core Data
-----------------------------------+----------------------------------------

Comment(by martinlagardette@…):

 Also if you ever want to try, here is the reduced code:

 {{{
 #!ruby
 framework 'CoreData'

 class Student < NSManagedObject
   attr_accessor :age

   def valueForUndefinedKey(key)
     p "#{self}::valueForUndefinedKey(#{key})"
   end

 end

 entityDesc = NSEntityDescription.new
 entityDesc.setName("Student")
 att = NSAttributeDescription.new
 att.setAttributeType(NSStringAttributeType)
 att.setName("age")
 entityDesc.setProperties([att])
 student = Student.alloc.initWithEntity(entityDesc,
 insertIntoManagedObjectContext:nil)
 student.setValue("42", forKey:"age")
 p student.valueForKey("age")
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/507#comment:2>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list