lib/collapsed_routes.rb in fizx-collapsed_routes-1.0.2 vs lib/collapsed_routes.rb in fizx-collapsed_routes-1.1.0

- old
+ new

@@ -17,19 +17,25 @@ end back.reverse.join(", ") end def collapse(names) + logger = ActionController::Base.logger base = names[-1].singularize parent = names[-2].singularize series = names.map(&:singularize).join("_") reversed = names.reverse.map(&:singularize) backtrack_base = backtrack reversed reversed.shift backtrack_parent = backtrack reversed %w[path url].each do |path| + logger.info "Defining route: #{base}_#{path}(#{base} = @#{base})" + logger.info "Defining route: edit_#{base}_#{path}(#{base} = @#{base})" + logger.info "Defining route: new_#{base}_#{path}(#{parent} = @#{parent})" + logger.info "Defining route: #{base.pluralize}_#{path}(#{parent} = @#{parent})" + ActionController::UrlWriter.module_eval <<-RUBY def #{base}_#{path}(#{base} = @#{base}) #{series}_#{path}(#{backtrack_base}) end \ No newline at end of file