Find not working properly


#1

here is the input view

<form method="post" action="found">
<br>
<b>Find by</b><br/>
<b>Vehicle Number:</b><br/>
<input id="truck_vehicleID" name="truck[vehicleID]" size="20" 
type="number" value=""/><br/>

</p>

<%= link_to "Find", :action => "found", :id => "@truck_vehicleID" %>
</form>

the controller

    def found
          @truck = Truck.find(:all,  :conditions => "trucks.vehicleID = 
'truck_vehicleID'")
          @oil = Oil.find(:all, :conditions => "vehicleID = 
'truck_vehicleID'")
          @apperance = Apperance.find(:all, :conditions => "vehicleID = 
'truck_vehicleID'")
          @brake = Brake.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'")
          @tred = Tred.find(:all, :conditions => "vehicleID = 
'truck_vehicleID'")
          @repair = Repair.find(:all, :conditions => "vehicleID = 
'truck_vehicleID'")
    end

and the output view (partial too big to put all here)

<% @truck.each do |truck|%>
<tr>
	<td><%= truck.vehicleID%></td>
	<td><%= truck.vin%></td>
	<td><%= truck.plate%></td>
	<td><%= truck.curmileage%></td>
	<td><%= truck.oilInt %></td>
</tr><p>
<% end %>

The variable doesn’t get passed properly so the found always comes up
with vehicleID 0. I don’t know if i have it named wrong in the
controller or what.
I have overriden the primary key in certain ways. (not the
set_primary_key because that does not allow you to manually write the
primary key. I am not useing auto increment because the primary key is
representing a truck #) IF you need to seem more of the code let me
know.


#2

I changed it to

def found
      @truck = Truck.find(@params["id"])
      @oil = Oil.find(:all, :conditions => ["vehicleID = 

:Truck_vehicleID", params])
@apperance = Apperance.find(:all, :conditions => “vehicleID =
‘truck_vehicleID’”)
@brake = Brake.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’”)
@tred = Tred.find(:all, :conditions => “vehicleID =
‘truck_vehicleID’”)
@repair = Repair.find(:all, :conditions => “vehicleID =
‘truck_vehicleID’”)
end

now i can get the right truck but not the sub data. I’m working on
getting the rest but a push in the right direction would be helpfull.