I would look for examples at https://github.com/josevalim/inherited_resources