Hi there!
I've got code duplication using strong_parameters:
class PeopleController < ApplicationController
# ...
protected
def person_params
params.permit(:name, pets: [ :name, :age ])
end
end
###
class PetsController < ApplicationController
# ...
protected
def pets_params
params.permit(:name, :age)
end
end
So if I need change permitted params for pets I should change it in two
files.
Am I doing wrong? Or how can I avoid code repetition?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.