here is the input view
[code]
<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>
[/code]
the controller
[code]
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
[/code]
and the output view (partial too big to put all here)
[code]
<% @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 %>
[/code]
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.
--
Posted via http://www.ruby-forum.com/.