Kay, agree to disagree, I suppose. :)
I can fix that up in a little bit.

Are we sticking with the initializer code, or are we thinking to move some
of it into a concern? I'm having a bit of a tough time wrapping my head
around what that entails, or whether it'll still be portable or not.


On Tue, Feb 11, 2014 at 3:32 PM, Robert Guthrie <notifications@github.com>wrote:

> In config/initializers/translatable.rb:
>
> > +module Translatable
> > +  module Model
> > +
> > +    def self.included(base)
> > +      base.send :extend, ClassMethods
> > +    end
> > +
> > +    module ClassMethods
> > +      def has_translations(fields = [], options = {})
> > +        define_singleton_method :translatable_fields, -> { (fields.kind_of? Array) ? fields : [fields] }
> > +        define_singleton_method :get_instance, ->(id) { send options[:load_via] || :find, id }
> > +        send :include, InstanceMethods
> > +        send :before_update, :clear_translations
> > +        send :has_many, :translations, as: :translatable
> > +
> > +        delegate options[:language_field] || :language, to: options[:delegate] if options[:delegate]
>
> Sorry but I disagree. I think its fine to say "thou shalt have a language
> method or specify thou language_method on initialise"
>
> passing delegate is like saying "thou should violate the law of demeter to
> use this module"
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/loomio/loomio/pull/1281/files#r9611774>
> .
>