Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The gem is written with performance in mind. It was developed to support the DAG
Again using the forum application as an example, one would have messages in a hierarchy with the additional ability of the message to reference each other. Querying could then e.g. look like this:


```
```ruby
# Fetch a root message with a specific subject.
message = Message.hierarchy_roots.where(subject: 'Some bogus')

Expand Down Expand Up @@ -64,7 +64,7 @@ TypedDag needs two AR models to be configured as the nodes and edges of the DAG.

To avoid having to configure TypedDag twice, in the node and in the edge AR model, configuration is done in a rails initializer. In your rails app, add a file to `config/initializers`.

```
```ruby
# /config/initializers/typed_dag.rb
# configuration for Relation/Message
TypedDag::Configuration.set edge_class_name: 'Relation',
Expand Down Expand Up @@ -170,7 +170,7 @@ The edge's table needs to be created containing at least the following columns (

A migration to create such a table could look like this:

```
```ruby
def change
create_table :edges do |t|
t.references :from, null: false
Expand Down Expand Up @@ -200,7 +200,7 @@ There are no requirements on the node's table.

When migrating from a different library, the details of course depend on the library used. If it is one of the many having a `parent_id` column on the node table, one would first have to create the edge table as outlined above and then add a SQL statement like this:

```
```ruby
ActiveRecord::Base.connection.execute <<-SQL
INSERT INTO edges
(from_id, to_id, hierarchy)
Expand All @@ -213,7 +213,7 @@ When migrating from a different library, the details of course depend on the lib

This will create all direct edges. Using

```
```ruby
Node.rebuild_dag!
```

Expand Down