spec/support/models.rb in mongoid-urls-0.3.0 vs spec/support/models.rb in mongoid-urls-0.5.0

- old
+ new

@@ -1,22 +1,24 @@ -# A nice model for a blog! -class Article - include Mongoid::Document - include Mongoid::Urls - field :title - url :title -end - # 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