mislav-will_paginate and acts_as_taggable_on_steorids problem

I always get the following problem:

Loading development environment (Rails 2.2.2) >> p = Frontpage.find 1

=> #<Frontpage id: 1, worker_id: 1, description: "dsadsa", show_date: "2008-11-22 11:20:27", hide_date: "2008-12-22 11:20:27", pos: nil, cached_tag_list: "", active: false, created_at: "2008-11-22 11:20:27", updated_at: "2008-11-22 11:20:27", frontpageimage_file_name: "08_08_2007_shoz.jpg", frontpageimage_content_type: "image/jpeg", frontpageimage_file_size: 203781, frontpageimage_updated_at: "2008-11-22 12:20:26">

>> p.tag_list.add "1" => ["1"]
>> p.save NoMethodError: undefined method `find_or_create_with_like_by_name' for #<Class:0x1ff912c> from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1833:in `method_missing_without_paginate' from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:167:in `method_missing' from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:182:in `save_tags' from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:181:in `each' from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:181:in `save_tags' from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction' from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in `transaction' from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:175:in `save_tags'

Jochen - I have mislav-will_paginate-2.3.6 running under Rails-2.2.2,
the app was migrated from Rails-2.2.0 with no changes. I can't say
anything about acts_as_taggable_on_steroids however.

Rick

Do you have your own class called Tag?

Fred

I always get the following problem:

Loading development environment (Rails 2.2.2) >> p = Frontpage.find 1

Do you have your own class called Tag?

class Frontpage < ActiveRecord::Base
   acts_as_taggable
   belongs_to :worker
   has_many :worker_comments, :as => :worker_commentable, :dependent => :destroy
   has_attached_file :frontpageimage,
                     :styles => { :original => "180x255", :thumb => "90x127" }
end

>> f = Frontpage.find 15
=> #<Frontpage id: 15, worker_id: 1, matchcode: "33", show_date: "2008-11-23 11:08:42", hide_date: "2008-12-23 11:08:42", pos: nil, cached_tag_list: nil, active: false, created_at: "2008-11-23 11:08:42", updated_at: "2008-11-23 11:08:42", frontpageimage_file_name: "11_07_2007_ishot_1.jpeg", frontpageimage_content_type: "image/jpeg", frontpageimage_file_size: 157393, frontpageimage_updated_at: "2008-11-23 12:08:41">
>> f.taggings
=> []
>> f.tag_list = "test"
=> "test"
>> >> f.taggings
=> []
>> f.save
NoMethodError: undefined method `find_or_create_with_like_by_name' for #<Class:0x211d2c4>
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1833:in `method_missing_without_paginate'
  from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:167:in `method_missing'
  from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:182:in `save_tags'
  from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:181:in `each'
  from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:181:in `save_tags'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in `transaction'
  from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:175:in `save_tags'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:178:in `send'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:178:in `evaluate_method'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:166:in `call'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:93:in `run'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:92:in `each'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:92:in `send'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:92:in `run'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/callbacks.rb:277:in `run_callbacks'
... 1 levels...
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:223:in `create_or_update'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2383:in `save_without_validation'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/validations.rb:1009:in `save_without_dirty'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/dirty.rb:79:in `save_without_transactions'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:179:in `send'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:179:in `with_transaction_returning_status'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in `transaction'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:138:in `transaction'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:178:in `with_transaction_returning_status'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:146:in `save_without_after_commit_callback'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:158:in `rollback_active_record_state!'
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:146:in `save_without_after_commit_callback'
  from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/vendor/plugins/thinking-sphinx/lib/thinking_sphinx/active_record/delta.rb:38:in `save'
  from (irb):177
  from /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:213>>

I always get the following problem:

Loading development environment (Rails 2.2.2) >> p =
Frontpage.find 1

Do you have your own class called Tag?

class Frontpage < ActiveRecord::Base
  acts_as_taggable
  belongs_to :worker
  has_many :worker_comments, :as => :worker_commentable, :dependent
=> :destroy
  has_attached_file :frontpageimage,
                    :styles => { :original => "180x255", :thumb =>
"90x127" }
end

Well done for reposting your original post but the question was
whether you have you own Tag class (in app/models)

Fred

class Tag < ActiveRecord::Base

   has_many :worker_comments, :as => :worker_commentable

   has_many :taggings, :dependent => :destroy
   belongs_to :worker

   define_index do
     indexes :name, :sortable => true, :unique => true
     set_property :delta => true
   end

   named_scope :newest_tags,
               :order => "created_at DESC",
               :group => "name",
               :limit => 50

   named_scope :alphabetic_taglist,
               :order => "name DESC"

end

That's the problem. Acts as taggable on steroids defines its own Tag
class, your tag class doesn't have all the methods that one has.

Fred

Ok, thanx! That was the problem .... great!!!!!

Jochen Kaechelin wrote: