[Rails] Need help with a Power Find()

Rob Biedenharn Rob at AgileConsultingLLC.com
Wed Mar 1 23:08:37 GMT 2006


On Mar 1, 2006, at 3:53 AM, Norman Timmler wrote:

> Am Dienstag, den 28.02.2006, 13:40 -0600 schrieb Dan Wright:
>
>> I was hoping someone would be able to help me with creating a method.
>>
>> I have two tables.  What I am trying to do is create a list of all  
>> the
>> id's from table2 that aren't currently referenced by Table1's
>> address_id column. That way, when I create a new customer I can  
>> have a
>> drop down list in the view of all the addresses that are not  
>> currently
>> being used.
>>
>
> I gave your classes different names, because i don't know how Rails  
> will
> deal with pluralization and digits.
>

By default, it adds or removes an 's'.  I have an application right  
now that has a table whose name ends in a digit and it works just  
fine.  It would be like a table of (US) tax forms W-2 called "w2s"  
with "class Worker < ActiveRecord::Base; has_many :w2s; end"

-Rob



More information about the Rails mailing list