Class: PostsController

Inherits:
Spree::BaseController
  • Object
show all
Defined in:
app/controllers/posts_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/posts_controller.rb', line 4

def index
  @tag   = params[:tag]
  @year  = params[:year]
  @month = params[:month]
  @day   = params[:day]

  @posts = @year ? Post.by_date(@year.to_i, @month.try(:to_i), @day.try(:to_i)) : Post
  @posts = @posts.published
  @posts = @posts.tagged_with(@tag) if @tag

  respond_to do |format|
    format.html { @posts = @posts.paginate(:page => params[:page], :per_page => 10) }
    format.rss
  end
end

#showObject



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

def show
  @post = Post.published.find_by_permalink(params[:id])
end