Project

ants

0.0
No commit activity in last 3 years
No release in over 3 years
Collection of concerns and helpers for Rails + Mongoid + Character web development.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
>= 4.2
~> 10.0
>= 2.0
>= 0.0.2

Runtime

 Project Readme

Ants

GitHub version Build Status Code Climate Coverage Status

Collection of concerns and helpers for Rails + Mongoid + Character stack.

Id

Orderable

Adds ordering functionality to the model. Default order is assending by _position field.

Usage:

  include Ants:Orderable

NOTE: If this concern is added to model with already existing documents, value for _position field should be initialized with this command:

ModelClass.all.set(_position: 1000)

OrderableReverse

Meta

Adds set of page meta fields and creates default methods that should be overriden if necessary:

  • _meta_title
  • _meta_description
  • _meta_keywords
  • _opengraph_image_url

Usage:

  include Ants:Meta

Featurable

Hideable

When you need to hide some documents from public or often used as draft analogue:

Usage:

  include Ants:Hideable

Scopes:

  • hidden
  • not_hidden

Helpers:

  • hide!
  • unhide!
  • hidden?

Slug

Scheduled

Sorted Relations

In Mongoid, the HM & HABTM relations return docs in random order. This workaround provides an ability to retrieve related documents in the same order it was stored.

Usage example:

class Post
  include Mongoid::Document
  include Ants::SortedRelations

  field :title

  has_and_belongs_to_many :authors
  sorted_relations_for :authors
end

post = Post.new title: 'RESTful actions with Mongosteen'
post.sorted_author_ids = [ Author.create(name: "Oleksandr Kravets").id,
                           Author.create(name: "Roman Brazhnyk"   ).id,
                           Author.create(name: "Maxim Melnyk"     ).id ]

post.sorted_authors.map(&:name)
#=> ['Alexander Kravets', 'Roman Brazhnyk', 'Maxim Melnyk']

Versions

Provides a helper method to get a list of document versions, used by chr + mongosteen:

Usage:

  include Ants:Versions

Helpers:

  • _document_versions

AdminUsers

Settings

Redirects

Content

Menus

Profile