ruby on rails - fetch different keys with different attributes(params) -
def appliance_params params.require(:tv).permit(:x, y:, :z) end
in example receive key 'tv' , values x, y, , z.
how can modify function receive different keys ?
this function can receive different appliances, can receive :iron, :computer etc... different values.
i receive 1 appliance in params.
def appliance_params params.require(:tv).permit(:x, :y, :z) end
is specific tv model.
to other params use:
params[:iron]
or if iron param part of tv take in permit call:
def appliance_params params.require(:tv).permit(:x, :y, :z, :iron) end
Comments
Post a Comment