Re: [Rails 3.2] How to extend a gem model

Tommaso Visconti
Mon, 14 Jan 2013 10:54:43 -0000

Erwin ha scritto:
> I am using the gem ''acts-as-taggable-on'' ( mbleigh) and I
need to extend
> the Tag model to translate the tag name with Globalize
> How can I add "translates :name" into ActsAsTaggableOn::Tag ? I
can fork
> the gem and modify my version, but is there any way to do it simply with
> "extend ActiveSupport::Concern" ?

You can decorate the class:

ActsAsTaggableOn::Tag.class_eval do
   translate :name
end

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.