lib/cistern/collection.rb in cistern-1.0.1.pre1 vs lib/cistern/collection.rb in cistern-1.0.1.pre2
- old
+ new
@@ -5,14 +5,14 @@
:shuffle!, :slice!, :sort!, :sort_by!, :delete_if,
:keep_if, :pop, :shift, :delete_at, :compact
].to_set # :nodoc:
def self.service_collection(service, klass)
- plural_name = Cistern::String.underscore(Cistern::String.demodulize(klass.name))
+ plural_name = service.collection_method(klass)
service.const_get(:Collections).module_eval <<-EOS, __FILE__, __LINE__
def #{plural_name}(attributes={})
- #{klass.name}.new(attributes.merge(service: self))
+ #{klass.name}.new(attributes.merge(service: self))
end
EOS
end
attr_accessor :records, :loaded, :service