2
任何人都可以指出如何在處理活動資源關聯時添加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
但我發現了紅寶石:league_id prefix_option當我訪問索引頁丟失。任何幫助,將不勝感激。
@ranjith:那麼,你如何設置路線?我目前有淺路線,但我沒有找到一種方法來設置路線,幷包括self.site ...任何建議? –