class HomeController < ApplicationController
  def index
  	if params[:limit].blank?
  	  limit = 4
  	else
  	  limit = params[:limit]
  	end
    @q = Project.ransack(params[:q])
    @projects = @q.result.limit(limit)
    @projects = Project.ransack(params[{"q"=>{"s"=>"created_at desc"}}]).result.limit(limit) unless params[:q]
  end
end
