I've searched the message boards and the web, and I can't figure out
why I get a weird '# of arguments' error... :-\ Thanks in advance for
any help.
I have three models:
class User < ActiveRecord::Base
has_many :memberships
has_many :groups, :through => :memberships
end
class Group < ActiveRecord::Base
has_many :memberships
has_many :users, :through => :memberships
end
class Membership < ActiveRecord::Base
belongs_to :group
belongs_to :user
end
I have a user stored in @user,and I want a list of the groups, so I
write:
@user.group
and get this error:
wrong number of arguments (0 for 1)
I can reference @user.memberships.find(:first) and it works fine.
I can even reference
@user.memberships.find(:first).some_random_attribute and it works,
too.
but if I try @user.memberships.find(:first).group it barfs with
the same error!
I have also tried (for experimentation):
@user.group(1)
and I still get the error: wrong number of arguments (0 for 1)
CREATE TABLE `memberships` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`member_type` int(11) NOT NULL default '0' COMMENT 'regular users
are type ''0'', moderators and owners get a higher type',
`user_status` int(11) NOT NULL default '1' COMMENT '0 is offline; 1
is online',
PRIMARY KEY (`id`)
)
I just tried re-installing Ruby, Rails and XAMPP on a different
computer, copying over only the /app folder from my previous try...
here's the install stats:
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 0.9.5
Rails version 1.2.5
Active Record version 1.15.5
Action Pack version 1.13.5
Action Web Service version 1.2.5
Action Mailer version 1.3.5
Active Support version 1.4.4
I'm getting the same odd error... is there a good way to figure
out where Rails is getting this expectation for an argument?