I solved this using a select list with three options: "All", "Yes" and "No"
= select :q, :published_true, [['Yes', 1], ['No', 0]], { include_blank: 'All', selected: params[:q] ? params[:q][:published_true] : '' }
The query string for publish_true will look like this:
q[published_true]=1 1 will return published books
q[published_true]=0 0 will return unpublished books
q[published_true]= blank - will return both published and unpublished books
source share