lib/ronin/model/has_authors/has_authors.rb in ronin-1.0.0.pre4 vs lib/ronin/model/has_authors/has_authors.rb in ronin-1.0.0.rc1

- old
+ new

@@ -22,25 +22,29 @@ require 'ronin/author' module Ronin module Model # - # Adds an `authors` relation between a model and the `Ronin::Author` - # model. + # Adds an `authors` relationship between a model and the {Author} model. # module HasAuthors + # + # Adds the `authors` relationship and {ClassMethods} to the model. + # + # @param [Class] base + # The model. + # def self.included(base) base.send :include, Model base.send :extend, ClassMethods base.module_eval do # The authors associated with the model. - has 0..n, :authors, :through => DataMapper::Resource, - :model => 'Ronin::Author' + has 0..n, :authors, Ronin::Author, :through => DataMapper::Resource Ronin::Author.has 0..n, self.relationship_name, :through => DataMapper::Resource, - :model => self.name + :model => self end end # # Adds a new author to the resource.