John Kopanas
2006-Feb-17 16:35 UTC
[Rails] acts_as_versioned and acts_as_taggable on same model?
I am trying to use acts_as_versioned and acts_as_taggable (plugin) on the exact same model. Has anyone successfuly done this? I think what I need to do is make model_versions acts_as_taggable instead of my main model. Anyone have any other suggestions or any suggestions how to do this? Your Friend, John Kopanas http://www.kopanas.com ====================================================================http://www.soen.info - source of the freshest software engineering information on the net http://cusec.soen.info - software engineering conference
Rick Olson
2006-Feb-17 17:36 UTC
[Rails] acts_as_versioned and acts_as_taggable on same model?
On 2/17/06, John Kopanas <john@protoseinc.com> wrote:> I am trying to use acts_as_versioned and acts_as_taggable (plugin) on > the exact same model. Has anyone successfuly done this? I think > what I need to do is make model_versions acts_as_taggable instead of > my main model. Anyone have any other suggestions or any suggestions > how to do this? > > Your Friend, > > John Kopanas > http://www.kopanas.comWhat problems are you having? If you want acts_as_taggable on both your versioned and your regular model, do this: class Foo << AR::Base acts_as_versioned do def self.included(base) base.acts_as_taggable end end end -- Rick Olson http://techno-weenie.net
John Kopanas
2006-Feb-17 19:35 UTC
[Rails] acts_as_versioned and acts_as_taggable on same model?
The problem is that when I do:
n = Note.find(1)
n.tag_with("Introduction, XML, HTTP")
n.tags
n.tags results in [] because n.tags checks note_versions and not note
model which tag_with associates the tags to.
So I need n.tags to check for tags on notes and not note_versions.
Any clue how I would do this?
On 17-Feb-06, at 12:36 PM, Rick Olson wrote:
> On 2/17/06, John Kopanas <john@protoseinc.com> wrote:
>> I am trying to use acts_as_versioned and acts_as_taggable (plugin) on
>> the exact same model. Has anyone successfuly done this? I think
>> what I need to do is make model_versions acts_as_taggable instead of
>> my main model. Anyone have any other suggestions or any suggestions
>> how to do this?
>>
>> Your Friend,
>>
>> John Kopanas
>> http://www.kopanas.com
>
> What problems are you having? If you want acts_as_taggable on both
> your versioned and your regular model, do this:
>
> class Foo << AR::Base
> acts_as_versioned do
> def self.included(base)
> base.acts_as_taggable
> end
> end
> end
>
> --
> Rick Olson
> http://techno-weenie.net
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
John Kopanas
http://www.kopanas.com
====================================================================http://www.soen.info
- source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference