Reputation: 41
Can anyone point me to how to add the prefix_option when dealing with active resource association? I have done the following but with no success:
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
But I'm getting ruby :league_id prefix_option missing when I visit the index page. Any help would be appreciated.
Upvotes: 2
Views: 891
Reputation: 72
I think your active resource simply should be
class League < ActiveResource::Base
has_many: teams
end
class Team < ActiveResource::Base
belongs_to: league
end
Upvotes: 1