Module Cms::Behaviors
In: lib/cms/behaviors/archiving.rb
lib/cms/behaviors/attaching.rb
lib/cms/behaviors/categorizing.rb
lib/cms/behaviors/connecting.rb
lib/cms/behaviors/dynamic_attributes.rb
lib/cms/behaviors/flush_cache_on_change.rb
lib/cms/behaviors/hiding.rb
lib/cms/behaviors/pagination.rb
lib/cms/behaviors/publishing.rb
lib/cms/behaviors/rendering.rb
lib/cms/behaviors/searching.rb
lib/cms/behaviors/soft_deleting.rb
lib/cms/behaviors/taggable.rb
lib/cms/behaviors/userstamping.rb
lib/cms/behaviors/versioning.rb
lib/cms/behaviors.rb

Behaviors are used in CMS to add features to a model. They are very similar to the various "acts_as_*" or "*_fu" plugins/gems that have been created for Rails.

Generally, each behavior has three modules in it. They are:

When the CMS starts up, all of the Behaviors are included into ActiveRecord::Base. The MacroMethods module of each Behavior is also included into ActiveRecord::Base. The MacroMethods module contains Class methods that you can call within your model in order to enable that Behavior for that Class. For example, if you want to have an Article module that is taggable, you would do this:

    class Article < ActiveRecord::Base
      is_taggable
    end

So in this case, you are calling the `is_taggable` macro method, which enables the taggable behavior for the Article model. It enables the behavior by extending the ClassMethods module and including the InstanceMethods module into the Article class. Each Behavior typically has one macro method which takes an options Hash, which of course varies from Behavior to Behavior. The macro method will also sometimes call other macro methods, like before_fitler, named_scope, etc. to modify the model. Consult the documentation for each module for specific details as to what the Behavior does.

Classes and Modules

Module Cms::Behaviors::Archiving
Module Cms::Behaviors::Attaching
Module Cms::Behaviors::Categorizing
Module Cms::Behaviors::ClassMethods
Module Cms::Behaviors::Connecting
Module Cms::Behaviors::DynamicAttributes
Module Cms::Behaviors::FlushCacheOnChange
Module Cms::Behaviors::Hiding
Module Cms::Behaviors::InstanceMethods
Module Cms::Behaviors::Pagination
Module Cms::Behaviors::Publishing
Module Cms::Behaviors::Rendering
Module Cms::Behaviors::Searching
Module Cms::Behaviors::SoftDeleting
Module Cms::Behaviors::Taggable
Module Cms::Behaviors::Userstamping
Module Cms::Behaviors::Versioning

[Validate]