I have 3 nested resources: sources, twitter_source and twitter_aggregation_methods.
The relationship of their respective models is as follows:
sources.rb
has_many :twitter_sources
has_many :rss_sources
twitter_source.rb
has_many :twitter_aggregation_methods
belongs_to :source
twitter_aggregation_method.rb
belongs_to :twitter_source
The config/routes.rb is set up as follows:
resources :sources do
resources :rss_sources
resources :twitter_sources do
resources :twitter_aggregation_methods
resources :influencer_trends do
resources :trends
end
end
end
When I try to add a new twitter_aggreggation_method
I get the following error:
NoMethodError in TwitterAggregationMethods#new
Showing /home/notebook/work/abacus/app/views/twitter_aggregation_methods/_form.html.erb where line #1 raised:
undefined method `twitter_source_twitter_aggregation_methods_path' for #<#<Class:0xb982e10>:0xc104ef4>
My views/twitter_aggregation_methods/_form.html.erb
is as follows:
<%= form_for([@twitter_source, @twitter_aggregation_method]) do |f| %>
<% if @twitter_aggregation_method.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@twitter_aggregation_method.errors.count, "error") %> prohibited this twitter_aggregation_method from being saved:</h2>
<ul>
<% @twitter_aggregation_method.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :twitter_source_id %><br>
<%= f.text_field :twitter_source_id, value: @twitter_source.id %>
</div>
<div class="field">
<%= f.label :aggregation_method %><br>
<%= f.text_field :aggregation_method %>
</div>
<div class="actions">
<%= f.submit %>
The error points to the first line of this partial.