Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  def users_within_country
    country_clans = self.find_all_by_country(self.country)
    unless country_clans.empty?
      clans_users = []
      country_clans.each do |clan|
        clans_users += clan.users
      end
      results = attach_needed_user_data(clans_users)
    else
      results = []
    end

    results
  end

Rails console

1
2
3
4
5
6
7
>> flc
=> #<Clan id: 9, name: "Francis Low's Clan", created_at: "2009-11-12 03:29:29", updated_at: "2009-11-12 03:29:29", country: "undisclosed location">
>> country_clans = Clan.find_all_by_country(flc.country)
=> [#<Clan id: 9, name: "Francis Low's Clan", created_at: "2009-11-12 03:29:29", updated_at: "2009-11-12 03:29:29", country: "undisclosed location">]
>> flc.users_within_country 
NoMethodError: undefined method `find_all_by_country' for #<Clan:0x1031f50c8>