In polymorphic_routes.rb, polymorphic_url is defined in rails source from github,and this particular line:
inflection = if options[:action] && options[:action].to_s == "new" args.pop :singular elsif (record.respond_to?(:persisted?) && !record.persisted?) args.pop :plural elsif record.is_a?(Class) args.pop :plural else :singular end
what's the purpose of extracting last element of array here? At this point args will either be an array of activerecord objects, or just be a single activerecord object in an array.