UX: include more details on Permalinks page

This commit is contained in:
Arpit Jalan
2015-07-17 15:53:48 +05:30
parent 5e38512b1b
commit 5fc7545c01
5 changed files with 69 additions and 15 deletions

View File

@@ -80,6 +80,16 @@ class Permalink < ActiveRecord::Base
return category.url if category
nil
end
def self.filter_by(url=nil)
permalinks = Permalink
.includes(:topic, :post, :category)
.order('permalinks.created_at desc')
permalinks.where!('url ILIKE :url OR external_url ILIKE :url', url: "%#{url}%") if url.present?
permalinks.limit!(100)
permalinks.to_a
end
end
# == Schema Information