Alias for *table*_id


#1

I have a table contacts, in another controller I refer to a particular
contact_id as transfer_attorney_id or electrical_inspector_id - how do I
create the necessary alias in the Contacts model?


#2

bmgz wrote:

I have a table contacts, in another controller I refer to a particular
contact_id as transfer_attorney_id or electrical_inspector_id - how do I
create the necessary alias in the Contacts model?


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

sorry i didn’t explain this well,

I guess ill have to have an alias (transfer_attornies) for the table
contacts, currently in my controller I have to do the following:

@contract = Contract.find(params[:id])
@attorney = Contact.find(@contract.transfer_attorney_id)

istead I want to do this

@contract = Contract.find(params[:id])
@attorney = Contact.find_by_transfer_attorney_id()

(or something like that…)