Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating readme with first-time setup details #7

Merged
merged 1 commit into from
Jun 5, 2018

Conversation

wheeyls
Copy link
Contributor

@wheeyls wheeyls commented Apr 28, 2018

No description provided.

README.md Outdated
add_column :my_table, :parentry, :ltree
add_column :my_table, :parent_id, :integer

add_column :my_table, :parent_depth, :integer, default: 0 # optional
add_index :my_table, :parentry
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ltree extension works best with a gist index.

README.md Outdated
add_column :my_table, :parentry, :ltree
add_column :my_table, :parent_id, :integer

add_column :my_table, :parent_depth, :integer, default: 0 # optional
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parentry_depth is the column that will be used for the depth cache.

README.md Outdated
@@ -26,11 +26,23 @@ Or install it yourself as:

## Usage

This gem requires 2 columns for each table: `parentry` and `parent_id`. A sample migration would look like:
This gem requires 2 columns for each table: `parentry` and `parent_id`, and is dependent on the `ltree` postgresql extension. A sample migration would look like:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ltree is actually not a requirement. You can persist the hierarchy as an array if you can't or don't want to use the ltree module.

class MyTable < ApplicationRecord
  include Parentry
  parentry strategy: :array
end

I really need to spend some time on adding good documentation for this gem.

@hasghari hasghari merged commit d3051f8 into hasghari:master Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants