[Rails] linking many to one id column

2009-07-15 Thread Martyn Elmy-liddiard
Another newbie question I fear but help as always appreciated. I have a tools table and a controls table and for each 'tool' I allow user to specify upto 3 controls. So the Tools table is :- id desc control_id1 control_id2 control_id3 and the Controls table is: id controldesc I have linked

[Rails] check for empty? in the view

2008-12-03 Thread Martyn Elmy-liddiard
I nned to get an associsted name from one table dependent on the related id value in another table when rendering the view but cant figure out the syntax to handle pontential empty values:- i.e. docv.policy_id OR docv.standard_id will exist and therefore link back to the policies OR the

[Rails] Re: check for empty? in the view

2008-12-03 Thread Martyn Elmy-liddiard
Frederick Cheung wrote: On Dec 3, 1:59?pm, Martyn Elmy-liddiard [EMAIL PROTECTED] s.net wrote: don't think you need anything more than if docv.policy Fred Thanks Fred but I still get an error:- I gave a vey simple example and it may be fairer to give a slightly different example that I

[Rails] Re: check for empty? in the view

2008-12-03 Thread Martyn Elmy-liddiard
mahmoud said wrote: On Wed, Dec 3, 2008 at 4:30 PM, Martyn Elmy-liddiard [EMAIL PROTECTED] wrote: Thanks Fred but I still get an error:- ...etc and the error I get is:- You have a nil object when you didn't expect it! The error occured while evaluating nil.year -- That's