views:

286

answers:

3

This is going to be a really dumb question, I just know it, but I'm going to ask anyways because it's driving me crazy.

How do I get acts-as-taggable-on to work?

I installed it as a gem with gem install acts-as-taggable-on because I can't ever seem to get installing plugins to work, but that's a whole other batch of questions that are all probably really dumb. Anyways, no problems there, it installed correctly.

I did ruby script/generate acts_as_taggable_on_migration and rake db:migrate, again no problems.

I added acts_as_taggable to the model I want to use tags with, started up the server and then loaded the index for the model just to see if what I've got so far is working and got the following error: undefined local variable or method `acts_as_taggable' for #.

I figure that just means I need to do something like require 'acts-as-taggable-on' to my model's file because that's typically what's necessary for gems. So I did that hit refresh and got uninitialized constant ActiveRecord::VERSION. I'm not even going to pretend to begin to know what that means went wrong.

Did I go wrong somewhere or there something else I need to do. The installation instructions seem to me like they just assume you generally know what you're doing and don't even begin to explain what to do when things go wrong.

+1  A: 

Maybe following the installation here can help.

For example you don't need to:

require 'acts-as-taggable-on'

but:

class User < ActiveRecord::Base
  acts_as_taggable
end

Otherwise you need to post more details about the error.

tommasop
When I do acts_as_taggable in the model it just says that method is undefined. The link you posted is exactly the documentation to which I was referring. Installing it as a plugin doesn't work for me (script/plugin) says the plugin at the link isn't found. I tried downloading it and putting it into my vendor/plugins directory and had no luck whatsoever. That's why I ended up installing it as a gem.
seaneshbaugh
+1  A: 

I installed acts-as-taggable-on for my app through github. If you want to try that method instead of the gem, you can read my this post that explains my experience: http://blog.mediummassage.com/2010/04/27/creating-categories-in-the-store-with-tags/

Jake
This is much better than the official "documentation" but script/plugin install git://github.com/mbleigh/acts-as-taggable-on.git does not work at all. I keep getting Plugin not found: ["git://github.com/mbleigh/acts-as-taggable-on.git"].
seaneshbaugh
Ok, so I uninstalled the gem and downloaded the zip for the plugin and added it to my vendors/plugin directory and I keep getting undefined method `acts_as_taggable_on' for #<Class:0x7978ab8>. This just isn't working at all...
seaneshbaugh
+1  A: 

Did you try to define your gem dependencies in config/environment.rb (Rails 2.3):

Rails::Initializer.run do |config|
  #...
  config.gem 'acts-as-taggable-on'
  #...
end

Or in Gemfile for Rails 3 or if you use already Bundler with rails 2.3:

gem 'acts-as-taggable-on'

This should make the require 'acts-as-taggable-on' unnecessary

jigfox
Unfortunately I'm using rails 2.0.2 because at the moment I'm stuck with InstantRails. Could it be that this plugin isn't compatible with rails 2.0.2?
seaneshbaugh
Yes, I believe that is the Problem!Why are you stuck with InstantRails? InstantRails' last release is more than 2 years old. I would highly recommend using the actual 2.3.5 release of rails directly
jigfox