On Wed, 2006-02-08 at 23:07 -0500, Wilson B. wrote:
placement controller into irb, I could probably try out finds
@placements is likely to be an Array of Placement instances.
this has turned out to be a real bugger…and I’ve has some great advice
from some very smart people (where’s Estelle when I need her?
as you can see by the log…the data is there but it certainly is
delivering a ‘null’ in the SQL Select command…
Processing PlacementsController#findresult (for 127.0.0.1 at 2006-02-08
23:13:22) [POST]
Parameters: {“commit”=>“Find”, “action”=>“findresult”,
“controller”=>“placements”, “placement”=>{“beg_referral_date”=>“”,
“end_referral_date”=>“”, “beg_discharge_date”=>“”,
“end_intake_date”=>“01/01/2007”, “end_discharge_date”=>“”,
“beg_intake_date”=>“01/01/2001”}}
(separation here for readability)
Placement Count (0.002219) SELECT COUNT(*) FROM placements WHERE
(intake_date between NULL and NULL)
Placement Load (0.009762) SELECT * FROM placements WHERE
(intake_date between NULL and NULL) LIMIT 14 OFFSET 0
Rendering within layouts/placements
Rendering placements/findresult
Completed in 0.05280 (18 reqs/sec) | Rendering: 0.00669 (12%) | DB:
0.01198 (22%) | 200 OK [http://localhost/placements/findresult]
[craig@srv2 th-db]$
Is it because it rails doesn’t recognize “01/01/2001” as a date?
Select * FROM placements WHERE (intake_date between NULL and NULL)
in case it offers clues…this is how the section goes…
def findresult
beg_intake_date = params[:beg_intake_date]
end_intake_date = params[:end_intake_date]
beg_referral_date = params[:beg_referral_date]
end_referral_date = params[:end_referral_date]
beg_discharge_date = params[:beg_discharge_date]
end_discharge_date = params[:end_discharge_date]
if beg_intake_date != "" then
@placement_pages, @placements = paginate(
:placements,
:conditions => ["intake_date between ? and ?",
beg_intake_date, end_intake_date],
:per_page => 14)
elsif beg_referral_date != "" then
I’m sure that I don’t have to keep repeating the pattern here…
This has taken up the WHOLE evening - ouch
Craig