See this StackOverflow question to understand what all this is for.
Thanks for any help.
Attached are:
01_config_routes.rb
-- showing how the:comments
resource is nested within:articles
02_app_models_article.rb
-- showing the (containing)Article
model03_app_models_comment.rb
-- showing the (contained)Comment
model04_app_models_ability.rb
-- "main" CanCanAbility
class; uses three modules (05-07) to manage the specifics of the three different roles (guest, logged-in user and admin);05_app_models_ability_guest_abilities.rb
-- CanCan ability definitions for guest user (nobody logged in);06_app_models_ability_user_abilities.rb
-- CanCan ability definitions for registered, logged-in user;07_app_models_ability_admin_abilities.rb
-- CanCan ability definitions for admin-role users;08_app_models_user.rb
-- simplistic Devise-equippedUser
model.
IMPORTANT IMPORTANT IMPORTANT
Controllers in this app are derived from Jose Valim's InheritedResources::Base
class rather than Rails' ApplicationController
. I suspect that the #update
call may be coming from there?
09_app_controllers_articles_controller.rb
is theArticle
controller. Adds CanCan'sload_and_authorize_resource
method;10_app_controllers_comments_controller.rb
is theComments
controller. Does the CanCan bit; declares that itbelongs_to :article
, and declares the five actions it uses. (It's a value object once created, so no:edit
or:update
.)