Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Aug 7th, 2006, 8:46 AM   #1
SirBob1701
Newbie
 
Join Date: May 2006
Posts: 20
Rep Power: 0 SirBob1701 is on a distinguished road
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
SirBob1701 is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
way to make a function execute at time 'x' badbasser98 C++ 10 Apr 5th, 2006 7:14 AM
Using Cron to Execute PHP Scripts NFreak PHP 9 Feb 17th, 2006 8:05 AM
Execute File Batch Commands johndoe Other Programming Languages 0 Sep 2nd, 2005 8:00 AM
A simple script to execute a command package satimis Bash / Shell Scripting 3 Aug 12th, 2005 11:28 PM
Is there a way to make a website automatically execute ... Sane Coder's Corner Lounge 18 Jul 23rd, 2005 7:07 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:20 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC