rails/rails — Issue #4650: respond_to? errors on HABTM associations
Author: hkarthik
Created: 2012-01-24 22:27:10+00:00
State: open

Assuming you have a typical Has And Belongs To Many type of Association like below:

```ruby
class Project < ActiveRecord::Base
has_and_belongs_to_many :campaigns
end

class Campaign < ActiveRecord::Base
has_and_belongs_to_many :projects
end
```
In Rails console, when you do the following:

`` p = Project.first ``

`` p.campaigns.respond_to? :each ``

You get the following:

`` ArgumentError: wrong number of arguments (0 for 1) ``

This problem doesn't exist on has_many type relations. respond_to? and the collection_proxy work just fine.

Currently this is an issue for any gems using respond_to? on collections like RABL, as they won't work with HABTM associated models.