query = Work.query
query.join(:editions)
query.join(:authors)
query.or.name_like(params[:title]).editions.name_like(params[:title])
query.or.authors.first_name_like(params[:author]).authors.last_name_like(params[:author])
query.editions.ean_like(params[:ean])
@editions = query.find.collect(&:editions).flatten