Forum: Ruby on Rails mislav-will_paginate and acts_as_taggable_on_steorids problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jochen K. (Guest)
on 2008-11-22 13:39
(Received via mailing list)
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'

-----------

mislav-will_paginate     newest version
acts_as_taggable_on_steorids  newest version


Any solutions?
Thanx

Jochen
Rick (Guest)
on 2008-11-23 01:38
(Received via mailing list)
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
Frederick C. (Guest)
on 2008-11-23 13:11
(Received via mailing list)
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
Jochen K. (Guest)
on 2008-11-23 13:44
(Received via mailing list)
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: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>>
Frederick C. (Guest)
on 2008-11-23 14:25
(Received via mailing list)
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
Jochen K. (Guest)
on 2008-11-23 15:01
(Received via mailing list)
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
Frederick C. (Guest)
on 2008-11-23 16:10
(Received via mailing list)
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
Jochen K. (Guest)
on 2008-11-23 17:00
(Received via mailing list)
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!!!!!
Tom erik S. (Guest)
on 2010-04-29 22:15
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?
This topic is locked and can not be replied to.