bterkuile/record_collection

Investigate persisted? behavior to make it more consistent

Opened this issue · 0 comments

At the moment the persisted? answer of a record collection returns false to obtain the proper route behavior as enforced by code in https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb

          named_route = if model.persisted?
                          args << model
                          get_method_for_string model.model_name.singular_route_key
                        else
                          get_method_for_class model
                        end

Maybe the singular_route_key of the collection should be the plural version of the record_class since it is a collection. This would semantically make more sense I believe.