aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Morearty <brian@morearty.org>2012-09-23 08:19:02 -0700
committerBrian Morearty <brian@morearty.org>2012-09-23 08:19:02 -0700
commit263764d13a9cd4eae60d1fa9e50af57f506f3dd4 (patch)
treeebbd6b6aac279c7d474dc18feb8fa6ce9898ae12
parentd9b873c4289c1e0dc1bf1d644fa827b600fb0893 (diff)
downloadrails-263764d13a9cd4eae60d1fa9e50af57f506f3dd4.tar.gz
rails-263764d13a9cd4eae60d1fa9e50af57f506f3dd4.tar.bz2
rails-263764d13a9cd4eae60d1fa9e50af57f506f3dd4.zip
Removed sorting of attribute names in controller generator.
I believe when people use generators, they typically order the parameters on the command line in an order that makes sense to them. Sorting them in the generated code makes the order seem more arbitrary to humans, even though it's less arbitrary to computers. :-) Example: rails g scaffold Post title:string content:text The human chose to put title before content. Sorted attributes in the generated code work but don't match the human's intent: params.require(:posts).permit(:content, :title)
-rw-r--r--railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
index 5d038d20e7..d6bce40b0c 100644
--- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
+++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
@@ -94,7 +94,7 @@ class <%= controller_class_name %>Controller < ApplicationController
<%- if attributes.empty? -%>
params[<%= ":#{singular_table_name}" %>]
<%- else -%>
- params.require(<%= ":#{singular_table_name}" %>).permit(<%= attributes.map {|a| ":#{a.name}" }.sort.join(', ') %>)
+ params.require(<%= ":#{singular_table_name}" %>).permit(<%= attributes.map {|a| ":#{a.name}" }.join(', ') %>)
<%- end -%>
end
end