View Single Post
Old Jun 1st, 2006, 9:37 AM   #1
SirBob1701
Newbie
 
Join Date: May 2006
Posts: 20
Rep Power: 0 SirBob1701 is on a distinguished road
Manually add Primary key and Finds

I have the primary key for table truck set to be vehicleID and when i pass this method
    def create
    @a_truck = Truck.new(@params['truck'])
    if @a_truck.save
        redirect_to :action => 'list'
        else
          render_action 'new'
        end
      end
truck_vehicleID it does not insert the id properly. but if i remove set primary key from the truck.rb the method works? i know it most be some base somewhere but how can i fix it?

also I was wondering how i can display data from many finds.
    def found
          @truck = Truck.find(:all, :conditions => "vehicleID = 'truck_vehicleID'")
          @oil = Oil.find(:all, :conditions => "vehicleID = 'truck_vehicleID'")
          @apperance = Apperance.find(:all, :conditions => "vehicleID = 'truck_vehicleID'")
          @inspection = Inspection.find(:all, :conditions => "vehicleID = 'truck_vehicleID'")
          @rdifferential = Rdifferential.find(:all, :conditions => "vehicleID = 'truck_vehicleID'")
          @tow = Tow.find(:all, :conditions => "vehicleID = 'truck_vehicleID'")
          @repair = Repair.find(:all, :conditions => "vehicleID = 'truck_vehicleID'")
    end
just prints out a blank screen event though there is a view for it.
SirBob1701 is offline   Reply With Quote