Forum: Ruby on Rails RE: I need superman!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
332b27a7e8304eaaf473752432a3f244?d=identicon&s=25 Neville Burnell (Guest)
on 2006-01-19 03:07
(Received via mailing list)
I think you should be able to make it work manually, although you miss
out on some rails 'magic' because of your schema requirements. For
example [psuedo rails code which doesn't take into account reserved
words, mysql quirks etc]

class Child < ActiveRecord::Base
  def find_parent
    Parent.find_all :conditions => ['number = ?', item_number[0..-3] +
'00' ]
  end
end

class Parent < ActiveRecord::Base
  def find_children
    Child.find_all :conditions => ['item_number like ?', number[0..-3] +
'%' ]
  end
end

HTH
This topic is locked and can not be replied to.