进行模型关联时缺少ActiverEsource prefix_option



任何人都可以指出我在处理活动资源关联时如何添加prefix_option吗?我做了以下操作,但没有成功:

class League < ActiveResource::Base
   has_many: teams
   self.site = "http://api-yyy.com/"
end
 class Team < ActiveResource::Base
   belongs_to: league
   self.site = "http://api-yyy.com/league/:league_id/"
 end

,在团队控制器中,我有:

def index 
  @league = League.find(params[:league_id])
  @teams = @league.teams 
end 

但是,当我访问索引页面时,我会发现Ruby:lueage_id prefix_option。任何帮助将不胜感激。

我认为您的活动资源应该是

class League < ActiveResource::Base
   has_many: teams
end
 class Team < ActiveResource::Base
   belongs_to: league
 end
您应该使用路线来展示您要如何查看自我。