|
Newbie
Join Date: May 2006
Posts: 20
Rep Power: 0 
|
Won't Execute other Find_by_sql
Hey guys heres some code I broke it up because the find_by_sqls would only work like that but now they don't work at all. It appears after the first one the interpreter doesn't call any of the other functions. Is this normal how can I get it to call all the other functions?
def find_others(id)
#NEW NOTE: FOR SOME REASON IT WOULD NOT ALLOW MULTIPLE FIND_BY_SQL
#IN ONE METHOD I MIGHT BE MISSING SOME KIND OF END BRAKE SO INSTEAD I
#THE SQLS INTO METHODS
# THE IFs THAT DO NOT ALLOW UNNEEDED HEADERS TO NOT BE DISPLAYED ARE IN THE VIEW
@array = [] #setting up the empty set for comparison later in view
@rdifferential = Rdifferential.find(:all, :conditions => ['vehicleID = ?', id])
@tow = Tow.find(:all, :conditions => ['vehicleID = ?', id])
@repair = Repair.find(:all, :conditions => ['vehicleID = ?', id])
@driver = Driver.find(:all, :conditions => ['vehicleID = ?',id])
oiled(id)
inspect(id)
braked(id)
appear(id)
treded(id)
end
def oiled(id)
@oil = Oil.find_by_sql (["SELECT lastDate, lastMile, cost FROM oils WHERE vehicleID = ? AND lastDate = (SELECT MAX(lastDate) FROM oils WHERE vehicleID = ?)", id , id]);
end
def braked(id)
@brake = Brake.find_by_sql (["SELECT lastdate, cost FROM brakes WHERE vehicleID = ? AND lastdate = (SELECT MAX(lastdate) FROM brakes WHERE vehicleID = ?)", id , id])
end
def inspect(id)
@inspection = Inspection.find_by_sql (["SELECT month, last, over, cost FROM inspections WHERE vehicleID = ? AND last = (SELECT MAX(last) FROM inspections WHERE vehicleID = ?)", id , id])
end
def treded(id)
@tred = Tred.find_by_sql (["SELECT FrontL, FrontR, BackL, BackR FROM treds WHERE vehicleID = ? AND tredID = (SELECT MAX(tredID) FROM treds WHERE vehicleID = ?)", id , id])
end
def appear(id)
@apperance = Apperance.find_by_sql (["SELECT exterior, interior, driverscab, trash, points FROM apperances WHERE vehicleID = ? AND appID = (SELECT MAX(appID) FROM apperances WHERE vehicleID = ?);", id , id])
end
|