Hi Everybody,
I have a simple form whose input I am trying to validate in the controller.
However, this if clause is not getting called at all... Is this a correct
way to do it?
Please help.
*In Controller (action is getting called and code in else gets executed)->*
begin
if (params[:fltAvailable].blank? || params[:user].blank?
params[:user]["lastname"].blank? || params[:user][:email].blank? ||
params[:user][:firstname].blank? ||
params[:fltAvailable][:from_airport].blank? ||
params[:fltAvailable][:from_time].blank? ||
params[:fltAvailable][:num_seats].blank? ||
params[:fltAvailable][:flight_type].blank? || *
params[:fltAvailable][:mfr_name].blank?*)
raise "error due to ..........."
else
..
..
..
end
*From log file (mfr_name is empty):*
Processing LocalFlightsController#save_flight (for 24.16.111.232 at
2008-08-07 22:01:11) [POST]
Session ID: 59114620aa763d537c7a80d0877163e5
Parameters: {"return_uri"=>"/local_flights/post_your_flight",
"user"=>{"lastName"=>"Garg", "firstName"=>"Rajat", "phone"=>"206-499-9495",
"email"=>"rajat_garg_79@hotmail.com"}, "commit"=>"List your Upcoming
Flight", "action"=>"save_flight", "fltAvailable"=>{"from_airport"=>"HQM",
"num_seats"=>"2", "estimated_flying_time"=>"1:00", "estimated_cost"=>"85 per
hou", "model_name"=>"172", "return_time"=>"Midnight", "description"=>"here
is the flight stuff", *"mfr_name"=>""*, "from_time"=>"11:00 AM",
"return_date"=>"mm/dd/yy", "from_date"=>"2008-08-21", "to_airport"=>"",
"aircraft_id"=>"3318J", "flight_type"=>"Local Tour"},
"controller"=>"local_flights", "fltPictures"=>{"uploaded_data"=>""}}
···
--
Rajat Garg
Ph: 206-499-9495
Add: 16140 SE EastGate Way APT E-204
Bellevue, WA 98008
Web: http://www.pilotoutlook.com
-----------------------------------------------------------------------------------------------------
Flying is the second greatest thrill known to man. Landing is the first!