After understanding the search functionality we will now include it in our employee application. We will search employees based on their name and then fetch the results.
To receive the entire data in JSON format, open the following link:
http://employee-rails.heroku.com/employees.json
To implement the search functionality of Rhodes, we will use the search method as mentioned earlier:
Add the following code in
employee_controller.rb
:def search Employee.search(:from => 'search', :search_params => {:name => @params['query']}, :callback => '/app/Employee/search_callback', :callback_param => "name=#{@params['query']}") @response['headers']['Wait-Page'] = 'true' render :action => :searching end def search_callback if @params['status'] == 'complete' @employees = Employee.find(:all, :conditions => {:name => @params['name']}) render_transition :action => :search else WebView...