Learn your way! Get started

Ruby on Rails, Part 4 of 5: Search and Sorting

with expert Jordan Hudgens

Watch trailer

Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack

Release date 11/3/2014
Level Beginner
Runtime 1h 3m
Closed captioning Included
Transcript Included
eBooks / courseware Included
Hands-on labs N/A
Sample code Included
Exams Included

Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More

Course description

This course covers a wide range of feature build outs, including some advanced development techniques, such as creating custom classes to handle a date range search feature. In being able to create custom classes to handle some of the non trivial aspects of the application, you will learn some key Rails fundamentals such as how to call the custom class in a controller and how to manage the data flow from other models. Next we will build a fully functional search engine into our application by leveraging the built in Postgres full text search functionality. As our program's data begins to grow, being able to quickly sort the data queries in the application view would be a very helpful feature, and with that in mind we will walk through how to build a number of custom Rails methods that will let users toggle the sort order in one of our table's columns simply by clicking on it. Lastly we will integrate pagination into our program, which will improve our page load performance, manage the user interface and allow for an improved level of control in regards to what is rendered on the page.


This course teaches anyone who is interested in learning the basics of programming computers using Ruby on Rails. This course has no programming language prerequisites and only assumes basic familiarity with computer usage. Anyone with moderate computer end-user experience should be able to take this course. Please view the Ruby on Rails: Intro to Development, Ruby on Rails: Best Practices, and Ruby on Rails: Data, Design and Deploy courses before taking this course.

Learning Paths

This course is part of the following LearnNowOnline SuccessPaths™:
Ruby Development

Meet the expert

Jordan Hudgens has certifications for Ruby on Rails, Thinkful; Ruby on Rails, Bloc.io; Front End Development, Thinkful; and AngularJS, Thinkful. He is currently vice president of engineering for TRACKR in Midland, Texas and is working on his PhD in Computer Science from Texas Tech. In addition to Ruby, Jordan works with PHP, JavaScript, MySQL, Postgres, CSS3, C, C++, C#, Objective-C, and Python. He also works with the frameworks Rails (Ruby), Zend (PHP), and Django (Python), plus the libraries AngularJS, jQuery, and Backbone.js.

Course outline

Search and Sorting

Date Range Search (23:08)
  • Introduction (00:25)
  • Custom Class (01:28)
  • Process (01:06)
  • Call from Controllers (00:42)
  • Demo: Custom Class (04:36)
  • Demo: Custom Scope (03:13)
  • Demo: Controller (02:51)
  • Demo: Update View (04:03)
  • Demo: Search Troubleshooting (04:21)
  • Summary (00:18)
PostGres Search (18:36)
  • Introduction (00:28)
  • Benefits (01:22)
  • Implementation (00:49)
  • Custom Method in the Model (00:39)
  • Demo: Controller Generator (04:51)
  • Demo: Search View (04:29)
  • Demo: Search Example (05:30)
  • Summary (00:26)
Column Sorting (14:00)
  • Introduction (00:28)
  • Options for Sorting (01:44)
  • Update the View (01:46)
  • Update the Controller (01:02)
  • Demo: Column Sorting (04:03)
  • Demo: Sort Example (04:36)
  • Summary (00:18)
Pagination (07:54)
  • Introduction (00:22)
  • What is Pagination? (02:51)
  • Setup (00:39)
  • Demo: Pagination (03:41)
  • Summary (00:18)