You're reading "Integrating with Middleman"

Link fields

Suppose our blog_post model has the following fields:

  • author: Single link referencing a user record;
  • related_posts: Multiple links referencing other blog_post records;

In this case, will return the linked user record (or nil, if the relation is empty), and blog_post.related will return an array of blog_post records.   # => "Mark Smith"

blog_post.related.each do |related_post|
  related_post.title         # => "Another post!"

Use method chains to navigate deep across your records' relationships:       # => "Tom Kepler"

Reverse lookups

You can easily find all the blog post for a specific author with this Ruby one-liner:

peter = dato.find("1413") { |blog_post| == peter }
Go ahead to: Image manipulation
Feel like something is missing in this page?
Submit an issue or Propose a change on Github!