Well CakePHP find is way much cooler from RoR
def index
if params[:term]
@employees = Employee.find(:all,
:conditions => ['first_name LIKE ? OR
last_name LIKE ? OR
email LIKE ? OR
mobile_number LIKE ? OR
description LIKE ? ', "%#{params[:term]}%",
"%#{params[:term]}%",
"%#{params[:term]}%",
"%#{params[:term]}%",
"%#{params[:term]}%"])
else
@employees = Employee.find(:all)
end
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @employees }
end
end
No comments:
Post a Comment