Skip to content

Instantly share code, notes, and snippets.

@llusdess
llusdess / users_controller.rb
Created February 28, 2018 03:44 — forked from danielpuglisi/users_controller.rb
Rails examples: Single Table Inheritance (STI), strong parameters, single controller.
# Variant 1
def user_params(type)
params.require(type.to_sym).permit(attributes)
end
# Variant 2
def user_params(type)
case type
when "user"
params.require(:user).permit(user_attributes)