On 15 Feb 2011, at 20:26, Mark <ander...@mitre.org> wrote: > > > In the Rails console: > > irb> ts = TableSchema.find(:first, :conditions => "table_name = > 'ENTITY_INST'") > => [#<TableSchema ID: "88E65D47-621C-4DD6-BD6F-B9ABD93437F8", > TABLE_NAME: "ENTITY_INST", DISPLAY_NAME: "Entity Instance" > , TYPE: 1, DESCR: "All \"real things\" - by label", DELETED_FLAG: > false, CLASS_ID: "085F7B9E-3 > 99D-48AD-A7A3-2AD48769F99B">] > > irb> ts.my_objects > NoMethodError: undefined method `my_objects' for #<Array:0x47c5830> > > irb> c = Classification.last > => #<Classification ID: "3E3A8383-8469-4847-8485-C6761B09FD46", > CLASS_TEXT: "UNCLASSIFIED"> > > irb> c.my_objects > => [] > > > 1. Why is ts.my_objects not defined, but c.my_objects IS (apparently) > defined?
It looks like you're getting an array containing a single object back, rather than that single object. Not sure why. > 2. c.my_objects should return dozens of MyObject objects. Why does it > return none? Does the SQL generated (check the log file) look right? > > - Mark > > I'm using Rails 3.0.3 > Ruby 1.8.7 > SQL Server 2008 > Windows XP (<sigh>) > > -- > 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@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.