Browse the Ruby on Rails Community.

You are here: Browse Railsplugins Acts As Branched

Acts As Branched

Should possibly change the name of the plugin, the call is ‘acts_as_branch_leaf’ as it made more sense than acts_as_branched, as the model itself isn’t branched, it is acting as a leaf of the branched tree

Applying acts_as_branch_leaf to a model:

  • gives it a has_many association with branchings
  • creates a branching with the current branch on object creation
  • overrides find and count to only return items from the current branch
  • forking of branches by calling branch.fork_at(time_to_fork)

Todo in later versions:

  • restoring branches (?)
  • add overrides to find and count to ignore the branch, find_without_branch maybe

Schemas:

This requires 2 models and therefor 2 tables, a branch_stems table and branchings table.
create_table :branch_stems do |t|
    t.column :created_on, :datetime
end
create_table :branchings do |t|
    t.column :created_on, :datetime
    t.column :branch_id,  :integer
    t.column :leaf_id,    :integer
    t.column :leaf_type,  :string
end

NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly

Users


See all details


Membership

+ Join this railsplugin

Record Maintainer

'None'