Class: Muck::BlogsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/muck/blogs_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/muck/blogs_controller.rb', line 6

def index
  if !@parent.blank?
    @blogs = @parent.blogs.by_newest rescue nil
    @blog ||= @parent.blog rescue nil
    if @blog
      redirect_to url_for([@parent, :blog, :posts])
      return
    end
  end
  @blogs ||= Blog.by_newest
  respond_to do |format|
    format.html { render :template => 'blogs/index', :layout => 'popup' }
    format.pjs { render :template => 'blogs/index', :layout => false }
  end
end

#showObject

redirect to the posts for the given blog



23
24
25
26
27
28
29
30
31
# File 'app/controllers/muck/blogs_controller.rb', line 23

def show
  if @parent
    @blog = @parent.blog
    redirect_to url_for([@parent, :blog, :posts])
  else
    @blog ||= Blog.find(params[:id])
    redirect_to blog_posts_path(@blog)
  end
end