Rails Condition Statement Issue -
I have no idea why I am having trouble with this simple thing but this situation statement is not working just is. @ Battalion = Battalion.Find (Param [: ID]) @ Soldier = @ Battalion Solars (: Terms => ["SeniorLoader =?", "No"])
This reflects the array of soldiers but my position has not been determined.
I am sure that I am doing something very simple wrong but I can not seem to know what it is.
Any help would be greatly appreciated
Based on the syntax you have In two lines, you can try the statuses as the property of the soldiers, and not actually trim your list below:
@soldier = @ battalion .soldiers.find (: all ,: terms => ["seniorlider =?", "No"])
The search method will help you sort through your soldiers I also recommend To make some great loads on your first line,
@battalion = Battalion.find (params [: id] ,: include => "military")
Therefore, the @ battalion object will already have information about all the soldiers, and for the row two a separate SQL query will not be required. Hope it helps.
Comments
Post a Comment