Skip to content

Commit a2cf56e

Browse files
committed
Update comment in controller generator templates
In 2013 this comment was updated in rails/rails@3f9baeb to say "Only allow a trusted parameter "white list" through." but no one ever noticed that it didn't update in an app that used jbuilder. jbuilder uses the same generators as Rails and actually overrides them when you do a scaffold generator with jbuilder installed. That means that this comment had the old text since 2013. Oops. In #33681 we also stopped using "whitelist" in Rails so I've updated this text and the text in Rails to remove this reference. See rails/rails#37390
1 parent 44bc207 commit a2cf56e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/generators/rails/templates/api_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def set_<%= singular_table_name %>
5151
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
5252
end
5353

54-
# Never trust parameters from the scary internet, only allow the white list through.
54+
# Only allow a list of trusted parameters through.
5555
def <%= "#{singular_table_name}_params" %>
5656
<%- if attributes_names.empty? -%>
5757
params.fetch(<%= ":#{singular_table_name}" %>, {})

lib/generators/rails/templates/controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def set_<%= singular_table_name %>
7272
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
7373
end
7474

75-
# Never trust parameters from the scary internet, only allow the white list through.
75+
# Only allow a list of trusted parameters through.
7676
def <%= "#{singular_table_name}_params" %>
7777
<%- if attributes_names.empty? -%>
7878
params.fetch(<%= ":#{singular_table_name}" %>, {})

0 commit comments

Comments
 (0)