Class: Monologue::PostsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/monologue/posts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#all_tags, #not_found, #recent_posts

Instance Method Details

#feedObject



20
21
22
# File 'app/controllers/monologue/posts_controller.rb', line 20

def feed
  @posts = Monologue::Post.published.limit(25)
end

#indexObject



4
5
6
7
# File 'app/controllers/monologue/posts_controller.rb', line 4

def index
  @page = params[:page].nil? ? 1 : params[:page]
  @posts = Monologue::Post.published.page(@page)
end

#showObject



9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/monologue/posts_controller.rb', line 9

def show
  if monologue_current_user
    @post = Monologue::Post.default.where("url = :url", {url: params[:post_url]}).first
  else
    @post = Monologue::Post.published.where("url = :url", {url: params[:post_url]}).first
  end
  if @post.nil?
    not_found
  end
end