Currently the packages controller is not working well. The JOIN is not the best way apparently as the 'description' column exists for both the "packages" and the "screenshots" table. So another way to query for the data needs to be found.
27 lines
696 B
Ruby
27 lines
696 B
Ruby
class PackagesController < ApplicationController
|
|
def index
|
|
@packages = Package
|
|
|
|
if params[:with_screenshots]=='yes'
|
|
@packages = @packages.joins(:screenshots).where('screenshots.approved = ?', true)
|
|
end
|
|
|
|
if params[:search]
|
|
query = '%'+params[:search]+'%'
|
|
# TODO: Index on lower(…) is missing. Does not scale.
|
|
# TODO: Consider using a serious search engine like Xapian or ElasticSearch.
|
|
@packages = @packages.where("lower(description) like lower(?) or lower(name) like lower(?)", query, query)
|
|
end
|
|
|
|
@packages = @packages.order('name').limit(20)
|
|
end
|
|
|
|
def with_screenshots
|
|
end
|
|
|
|
def without_screenshots
|
|
end
|
|
|
|
def moderate
|
|
end
|
|
end
|