I'm having some difficulty getting find_by_sql to work.

This code below works perfect:

@available = Elevator.find_by_sql("select name from elevator_timeslots
WHERE NOT EXISTS(select elevator_timeslot_id from elevators where
elevators.elevator_timeslot_id = elevator_timeslots.id)")

Now I'm trying to add one more condition which is causing me grief:

@available = Elevator.find_by_sql("select name from elevator_timeslots
WHERE NOT EXISTS(select elevator_timeslot_id from elevators where
elevators.elevator_timeslot_id = elevator_timeslots.id
and elevators.booked_date = ?", params[:booked_date]))   ** Added line
not working

Basically using

and elevators.booked_date = ?, params[:booked_date] is causing only
errors.

Any advise, I truely appreciate it.

Thanks in advance.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to