Skip to content

Instantly share code, notes, and snippets.

@sh-ft
sh-ft / controller_inheritance_example.rb
Created December 7, 2012 18:15
Controller inheritance use case for heimdallr-resource
# Let's say we have a blog app. A blog post has several child resources (comments, tags,
# etc.). The controllers for each of these resources share the same layout. Here's one
# way we could do it:
class BasePostsController < ApplicationController
include Heimdallr::Resource
load_and_authorize_resource :resource => :post
# We could have a before_filter here that sets some instance variables for the layout