4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/blog/tags_controller.rb', line 4
def index
if params[:tag_name]
paginate_options = {
:page => params[:page],
:per_page => (params[:per_page] || 5),
}
tags = ActsAsTaggableOn::Tagging.all(
:include => :tag,
:conditions => {
:tags => {
:name => params[:tag_name].humanize
},
:taggable_type => 'Paper'
}
)
papers = tags.map(&:taggable).uniq.select{ |p| p.state == 'published' }
unless papers.nil?
@papers = papers.paginate(paginate_options)
end
end
end
|