Class: Ecrire::PostsController

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

Direct Known Subclasses

PostsController

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #signed_in?

Instance Method Details

#indexObject



12
13
14
15
16
17
18
19
20
# File 'lib/ecrire/app/controllers/ecrire/posts_controller.rb', line 12

def index
  respond_to do |format|
    format.html
    format.rss
    format.json do
      headers['Access-Control-Allow-Origin'] = '*'
    end
  end
end

#showObject



22
23
24
25
# File 'lib/ecrire/app/controllers/ecrire/posts_controller.rb', line 22

def show
  redirect_to :root and return if post.nil?
  redirect_to :root and return unless post.published?
end