Class: Muck::BlogsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Muck::BlogsController
- Defined in:
- app/controllers/muck/blogs_controller.rb
Instance Method Summary collapse
- #index ⇒ Object
-
#show ⇒ Object
redirect to the posts for the given blog.
Instance Method Details
#index ⇒ Object
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 |
#show ⇒ Object
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 |