Class: PostsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_user!, #current_user, #load_settings

Instance Method Details

#feedObject


10
11
12
13
14
# File 'app/controllers/posts_controller.rb', line 10

def feed
  @posts = Post.published.order('published_at DESC').limit(5)

  render layout: false
end

#indexObject


2
3
4
# File 'app/controllers/posts_controller.rb', line 2

def index
  @posts = Post.published.order('published_at DESC').page(params[:page])
end

#showObject


6
7
8
# File 'app/controllers/posts_controller.rb', line 6

def show
  @post = Post.find_by_slug(params[:slug])
end