Mislav-will_paginate and acts_as_taggable_on_steorids problem


#1

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:inmethod_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:insave_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:insave_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:intransaction’ from /Users/bullet/Documents/RAILS_WORK/QUAMM/quamm/
vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb:
175:in `save_tags’


mislav-will_paginate newest version
acts_as_taggable_on_steorids newest version

Any solutions?
Thanx

Jochen


#2

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


#3

On Nov 22, 11:39 am, Jochen K. removed_email_address@domain.invalid wrote:

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?

Fred


#4

Am 23.11.2008 um 12:10 schrieb Frederick C.:

On Nov 22, 11:39 am, Jochen K. removed_email_address@domain.invalid wrote:

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:inmethod_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:insave_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:insave_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:intransaction’
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:insend’
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:incall’
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:ineach’
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:inrun’
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:increate_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:insave_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:insend’
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:intransaction’
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:intransaction’
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:insave_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:insave_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>>


#5

On 23 Nov 2008, at 11:43, Jochen K. removed_email_address@domain.invalid wrote:

Loading development environment (Rails 2.2.2) >> p =
: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


#6

Am 23.11.2008 um 13:24 schrieb Frederick C.:

acts_as_taggable
whether you have you own Tag class (in app/models)
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


#7

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

Sent from my iPhone


#8

Jochen K. wrote:

Am 23.11.2008 um 15:09 schrieb Frederick C.:

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.

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

Really strange. I had the same problem. I copied the contents of tag.rb
from the plugin into my app/model/tag.rb and it solved the problem.

But it just seems like the wrong way to do it…

Any ideas?


#9

Am 23.11.2008 um 15:09 schrieb Frederick C.:

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.

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