Hi, I found the problem below on the Rails wiki and have the very same problem. Can anyone suggest a solution that does not involve an extra object like on the wiki? Thanks, Peter From: http://wiki.rubyonrails.com/rails/pages/HowtoUseActsAsList I''m looking for a Howto that would explain how to use ActsAsList<http://wiki.rubyonrails.com/rails/pages/ActsAsList>where you have something like the following: Book * id * name Category * id * name books_categories * book_id * category_id * position The position in the books_categories table is relative to the category. Thus, under one category book A might be in position 4, while in another category it might be in position 1. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Greg Edwards
2005-Nov-18 23:00 UTC
problem with Ruby 1.9 override of Net::HTTP in Mechanize
Ok, I''ve searched everywhere trying to figure this one out... Mechanize (installed from gems) is trying to reference a function that it can''t find. I''m using: - Mechanize (install gem mechanize) - the newest Ruby / Rails versions. I''m getting this error: undefined method `add_header'' for #<Net::HTTP::Post POST> I know that mechanize is doing something with some files from Ruby 1.9 and has a file that says this: # required due to the missing get_fields method in Ruby 1.8.2 $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "mechanize", "net-overrides") and that it has this file: /usr/local/lib/ruby/gems/1.8/gems/mechanize-0.3.1/lib/mechanize/net-override s/net/http.rb So, for some reason it would appear that mechanize can''t see the over-ridden function??? It had the same problem with the "get_fields" function (which is in the same place, and is a thing the mechanize developer added since Ruby 1.8 doesn''t have the response.get_fields function), but I got around that by adding a function: def get_fields2(response,key) return nil unless response.header[key.downcase] response.header[key.downcase].dup end to /usr/local/lib/ruby/gems/1.8/gems/mechanize-0.3.1/lib/mechanize.rb and then changing the references to "response.get_fields(...)" to "get_fields2(response,...)" ... But that approach doesn''t work for the add_header function. Thanks for any help! -Greg Greg Edwards Chief Technical Officer Eyetools, Inc. (916) 792-4538 gedwards1-hwlMNW8dgodWk0Htik3J/w@public.gmane.org http://www.eyetools.com -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Peter Michaux Sent: Friday, November 18, 2005 1:10 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails] acts_as_list with has_and_belongs_to_many Hi, I found the problem below on the Rails wiki and have the very same problem. Can anyone suggest a solution that does not involve an extra object like on the wiki? Thanks, Peter From: http://wiki.rubyonrails.com/rails/pages/HowtoUseActsAsList I''m looking for a Howto that would explain how to use ActsAsList where you have something like the following: Book * id * name Category * id * name books_categories * book_id * category_id * position The position in the books_categories table is relative to the category. Thus, under one category book A might be in position 4, while in another category it might be in position 1. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Reading the Rails source for acts_as_list and the ActiveRecord base.rb, part of the problem seems to be that acts_as_list doesn''t now about model associations. Also it appears that sql update statements made with rails update_all cannot have multiple tables. Is all of this true? Couldn''t we have something like the following with the conventional join table being included automatically? Class Book < ActiveRecord::Base has_and_belongs_to_many :categories acts_as_list :include => :category, :scope => :category_id end Thanks, Peter _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Peter Michaux <petermichaux@...> writes:> > Hi, > > I found the problem below on the Rails wiki and have the very same problem.Can anyone suggest a solution that does not involve an extra object like on the wiki?> > Thanks, > Peter > > From: http://wiki.rubyonrails.com/rails/pages/HowtoUseActsAsList > > > I''m looking for a Howto that would explain how to use ActsAsList where youhave something like the following:>Hi, I just struggled through this myself, and came up with a temporary, but relatively simple solution: http://wiki.rubyonrails.com/rails/pages/HowToUseActsAsListWithHasAndBelongsToMany I''m fairly new to rails and ruby, though not DBs & Web programming, so feel free to refine the technique where it could be made more elegant!