Class: Monologue::ApplicationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Monologue::ApplicationController
show all
- Includes:
- ControllerHelpers::User
- Defined in:
- app/controllers/monologue/application_controller.rb
Instance Method Summary
collapse
Instance Method Details
12
13
14
15
16
17
|
# File 'app/controllers/monologue/application_controller.rb', line 12
def all_tags
@tags = Monologue::Tag.order("name").select{|t| t.frequency>0}
@tags_frequency_min = @tags.map{|t| t.frequency}.min
@tags_frequency_max = @tags.map{|t| t.frequency}.max
end
|
#archive_posts ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/monologue/application_controller.rb', line 30
def archive_posts
@archive_posts = {}
@first_post_year = DateTime.now.year
posts = Monologue::Post.published.limit(100)
if posts.length > 0
@archive_posts = posts.group_by {
|post| post.published_at.beginning_of_month.strftime("%Y %-m")
}
@first_post_year = posts.last.published_at.year
end
end
|
#not_found ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/monologue/application_controller.rb', line 19
def not_found
file = Rails.root.join('public', '404.html')
if file.exist?
render file: file.cleanpath.to_s.gsub(%r{#{file.extname}$}, ''),
layout: false, status: 404, formats: [:html]
else
render action: "404", status: 404, formats: [:html]
end
end
|
#recent_posts ⇒ Object
8
9
10
|
# File 'app/controllers/monologue/application_controller.rb', line 8
def recent_posts
@recent_posts = Monologue::Post.published.limit(3)
end
|