Alias for *table*_id

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?

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
[email protected]
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…)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs