Mass Assignment 以ä¸ãRuby on Rails Guidesã«æ²è¼ãããã»ãã¥ãªãã£ã«é¢ããè¨äºã®ä¸é¨ã®æ¥æ¬èªè¨³ã§ãã 6 Mass Assignment ãªãã®äºé²æªç½®ããªããã°ãModel.new(params[:model])ã¯ããã«ã¼ãã©ã®ãã¼ã¿ãã¼ã¹ã«ãã«ã©ã ã®å¤ãã»ããããã®ã許ãã¦ãã¾ãã Mass assignmentã®ç¹å¾´ã¯ãæ»æè ãmodelã®new()ã¡ã½ããã«æ¸¡ãããã·ã¥ãæä½ãããã¨ã§ã©ããªã¢ãã«ã®attributesã§ãã»ãããããã¨ã許ãã¦ãã¾ããããåé¡ã¨ãªããããããªãã def signup params[:user] #=> {:name => "ow3ned", :admin => true} @user = User.new(params[:user]) end Mass assignmentã¯å¤ãã®ä½æ¥ãçãããªããªãããããã
{{#tags}}- {{label}}
{{/tags}}