Forum: Ruby on Rails alias for *table*_id

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.
bmgz (Guest)
on 2006-01-18 12:48
(Received via mailing list)
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?
Brendon G. (Guest)
on 2006-01-18 13:09
(Received via mailing list)
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..)
This topic is locked and can not be replied to.