CRUD Doesn't Have an 'S' in It: Managing Complex Searching in Rails

Location: D138-139 Level: Novice
Average rating: ****.
(4.00, 2 ratings)

If your application has complex, multi-column search and order requirements, very likely you have already “hit the wall” with what ActiveRecord can do for you. Complex searches are “off-rails”, but what if you have to implement them anyway? The core Rails framework doesn’t offer much help.
In this presentation, I will provide concrete examples and strategies for coping with complex searches in Rails. Specifically, the presentation will cover the following topics:
Managing complex joins, columns and “where constraints” across multiple actions and controllers.
Coping with “stateful” searches across multiple action pages with complex constraints that may change by one constraint at a time: How to manage the data relationship between session and params.
Ordering instead of constraining: sometimes an “order by” is better than a “where constraint”. Particular attention will be paid to PostgreSQL’s order by “expressions” capability but these idea can be applied to MySQL and elsewhere.
Marshalling searches: how to save searches and re-load them later. Versioning persistent searches will also be discussed.
Options for object-oriented SQL management: several tools exist for using Ruby to build SQL. These will be presented.
There will be time for audience questions and discussion.

Photo of Stephen Midgley

Stephen Midgley

Steve is currently the founding CTO at a small internet real estate venture called He also consults regularly with the California Department of Education on a project called Brokers of Expertise, which will use web systems to share and build the expertise of educators.

Previously, Steve served as a Program Manager for the Stupski Foundation for six years, where he designed and implemented various grants for technology in K-12 education.

From 1995 to 2001 Steve worked as Vice President of Engineering and Senior Software Architect for LoopNet Inc., a commercial real estate listing firm. He designed and built LoopNet’s technology and web systems from its inception in 1995. He left the company in early 2001 to get involved with non-profit and philanthropic work. LoopNet remains a successful business and is currently listed on NASDAQ.

Steve is currently contributing to open source projects including writing a pure Ruby geocoding solution called GeoX, a simple Ruby image library called MojoMagick and integration testing Ara Howard’s ‘bj’ queue.

Addenda/Errata at

Full bio at:

News and Coverage
co-presented by Ruby Central, Inc. O'Reilly
  • Engine Yard
  • Sun Microsystems
  • FiveRuns
  • GotThingsDone
  • Heroku
  • ThoughtWorks
  • Atlantic Dominion Solutions
  • Blue Box Group
  • CodeGear
  • E-xact
  • ELC Technologies
  • EnterpriseDB
  • GemStone Systems
  • Intridea
  • Morph Labs
  • RightScale
  • TechRepublic

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at RailsConf, contact Yvonne Romaine.

Download the RailsConf Sponsor/Exhibitor Prospectus

Media and Promotional Opportunities

Download the Media & Promotional Partner Brochure (PDF) for more information on trade opportunities with O'Reilly conferences, or contact mediapartners@

Program Ideas

Post your suggestions for speakers, topics, and activities on the RailsConf wiki or send an email to

Press and Media

For media-related inquiries, contact

Contact Us

View a complete list of RailsConf 2008 contacts.