View Single Post
Old Jun 1st, 2006, 10:43 AM   #4
SirBob1701
Newbie
 
Join Date: May 2006
Posts: 20
Rep Power: 0 SirBob1701 is on a distinguished road
hers 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.
SirBob1701 is offline   Reply With Quote