ruby on rails - Combine strong params with other params -


how can combine strong other params when creating new object.

def params_test   params.permit(:test1, :test2, :test3) end = model.new(params_test) a.test4 = 'test4' a.test5 = 'test5' 

test4 , test5 coming db or cookies or other source in system. there way combine of them 1 line? or 2 lines?

you do:

model.new(params_test.merge({ test4: 'test4', test5: 'test5'})) 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -