Skip to content

Instantly share code, notes, and snippets.

View bismark64's full-sized avatar
💭
I may be slow to respond.

Emiliano Coppo bismark64

💭
I may be slow to respond.
View GitHub Profile
@bismark64
bismark64 / account.rb
Created December 15, 2014 13:51
Devise + MongoDB embedded users
class Account
include Regexs
include Mongoid::Document
include Mongoid::Timestamps
#has_many :users
embeds_many :users, store_as: :credentials
scope :for, ->(current_user_id){ where('credentials._id' => current_user_id) }
@bismark64
bismark64 / gist:5911034
Last active December 19, 2015 06:19
Two Ruby powerful iterators I really love

Two (or three) powerful iterators

If you have some experience working with Ruby you probably had to deal with collections. Collections can be tedious. But TTR (Thanks To Ruby) we have a large arsenal to deal with them!

In this post I'll show you two Ruby iterator methods I really love, thanks to its simplicity and beauty.

My whimsical example