I have three models defined as follows:
class Comic < ActiveRecord::Base
has_many :feeds
end
class Feed < ActiveRecord::Base
belongs_to :comic
has_many :filters
end
class Filter < ActiveRecord::Base
belongs_to :feed
end
In the filter form I have the following:
<%= f.collection_select :feed_id, Feed.all, :id, :url, { :include_blank => "Please select" } %>
Assuming there’s a :name field in my comic model how do I display it along the feed URL in the select?
I’d like the rendered HTML to look something like this:
<option value="1">Comic Name - Feed URL</option>
Thanks!
One idea would be to create a new instance method in the feed class for presenting the comic name along with the feed’s url: