Here is the complete error rails is throwing me:
Missing partial publisher_groups/publisher_group with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: blah blah blah
In the organization show view:
<%= render @organization.groups %>
In /views/groups/_group.html.erb:
<p><%= group.name %></p>
<p><%= group.type %></p>
The relationships exist in both the group model and the org model. The error references PublisherGroup. The Group model has STI of three types that as of now don't do anything but specify type. How can I get this render to behave properly as all of the @organization.group objects are subclasses of group?
By default trying to render an active model object tries to find a partial called table_name/class_name
In particular for an STI hierarchy it will look for a different template for each class. This is controlled by the to_partial_path
instance method which returns the path to the partial
If you override that method on group
def to_partial_path
'groups/group'
end
Then all the subclasses will use the same partial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With