Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rails/rails
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: capnregex/rails
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 13 commits
  • 2 files changed
  • 1 contributor

Commits on Aug 6, 2010

  1. Copy the full SHA
    f8c8dda View commit details
  2. Copy the full SHA
    64eecf3 View commit details

Commits on Aug 11, 2010

  1. Copy the full SHA
    3c37723 View commit details
  2. Copy the full SHA
    45ddc1a View commit details

Commits on Aug 12, 2010

  1. Copy the full SHA
    4fc9857 View commit details
  2. Copy the full SHA
    700d281 View commit details

Commits on Aug 16, 2010

  1. Copy the full SHA
    019d4aa View commit details

Commits on Aug 17, 2010

  1. Copy the full SHA
    53991c4 View commit details

Commits on Aug 18, 2010

  1. Copy the full SHA
    5029955 View commit details

Commits on Aug 23, 2010

  1. Copy the full SHA
    a055412 View commit details

Commits on Aug 26, 2010

  1. Copy the full SHA
    72e0795 View commit details

Commits on Sep 1, 2010

  1. Copy the full SHA
    634beaf View commit details

Commits on Sep 27, 2010

  1. Copy the full SHA
    5843281 View commit details
Showing with 13 additions and 6 deletions.
  1. +9 −5 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
  2. +4 −1 railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb
14 changes: 9 additions & 5 deletions actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
Original file line number Diff line number Diff line change
@@ -99,11 +99,15 @@ def polymorphic_url(record_or_hash_or_array, options = {})
record = extract_record(record_or_hash_or_array)
record = record.to_model if record.respond_to?(:to_model)

args = case record_or_hash_or_array
when Hash; [ record_or_hash_or_array ]
when Array; record_or_hash_or_array.dup
else [ record_or_hash_or_array ]
end
args = if record_or_hash_or_array.respond_to?(:polymorphic_url_args)
record_or_hash_or_array.polymorphic_url_args
else
case record_or_hash_or_array
when Hash; [ record_or_hash_or_array ]
when Array; record_or_hash_or_array.dup
else [ record_or_hash_or_array ]
end
end

inflection = if options[:action] && options[:action].to_s == "new"
args.pop
Original file line number Diff line number Diff line change
@@ -7,6 +7,8 @@ class ScaffoldGenerator < Base
include Rails::Generators::ResourceHelpers

argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
class_option :add_views, :type => :array, :default => [], :banner => "index _form etc", :desc => "add custom views/templates"
class_option :skip_views, :type => :array, :default => [], :banner => "index _form etc", :desc => "skip views/templates"

def create_root_folder
empty_directory File.join("app/views", controller_file_path)
@@ -22,8 +24,9 @@ def copy_view_files
protected

def available_views
%w(index edit show new _form)
( %w(index edit show new _form) | options[:add_views] ) - options[:skip_views]
end

end
end
end