DEV Community

Discussion on: [Rails] Getting polymorphic models with human name for view

Collapse
 
mikerogers0 profile image
Mike Rogers ✈️ • Edited

I've stopped using Helpers. What would find was a method would be named with the intension it was used in a single view scope (e.g. within app/views/users), then as it was available everywhere it would be reused without making the method name more explicit.

Instead I've opted for either model decorators, or the collection_select helper e.g:

<%= form.collection_select(:property_type, Contracts::Rental.property_types, :to_s, :model_name) %>
Thread Thread
 
n350071 profile image
n350071🇯🇵

LGTM!! It's a better way. Thank you.