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

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

LearnNow Online
Updated Aug 23, 2018

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.

Each LearnNowOnline training course is made up of Modules (typically an hour in length). Within each module there are Topics (typically 15-30 minutes each) and Subtopics (typically 2-5 minutes each). There is a Post Exam for each Module that must be passed with a score of 70% or higher to successfully and fully complete the course.


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.

Meet the expert

Jordan Hudgens

Jordan Hudgens has certifications for Ruby on Rails, Thinkful; Ruby on Rails,; 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.

Video Runtime

63 Minutes

Time to complete

178 Minutes

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)