Here are the classes as I have them set up:
class Stat < ActiveRecord::Base
belongs_to :stats_parent
end
class TotalStat < Stat
belongs_to :stats_parent
end
#The StatsParent class is just to show how I use the relation.
class StatsParent < ActiveRecord::Base
has_one :total_stat
has_many :stats
end
For the Stats Controller index action:
def index
@stats = Stat.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @stat }
end
end
In the index view for stats there is this bit of code:
<% @stats.each do |stat| %>
...
<td><%= link_to 'Show', stat %></td>
<% end %>
And I get this error:
undefined method `total_stat_path' for #<ActionView::Base:0x0000010324c1f8>
Why cant the link_to work here? Do I need to create a separate controller to handle the TotalStat
?