Sha256: 899ec8f3aebf1abc034ccb0aca4d018ce6b188b1772ec0fd547e61b16069ef40
Contents?: true
Size: 427 Bytes
Versions: 1
Compression:
Stored size: 427 Bytes
Contents
# A model with dynamic key class Company include Mongoid::Document include Mongoid::Urls field :name field :nick has_many :articles url :nick, :name, :fullname def fullname return nick + ' - ' + name if nick && name nick || name end end # A nice model for a blog! class Article include Mongoid::Document include Mongoid::Urls field :title belongs_to :company, optional: true url :title end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-urls-0.5.0 | spec/support/models.rb |