0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

strong parameter内で使うmerge以下について

Posted at

def purchase_record_params
params.require(:purchase_record).permit(:zip_code, :region_of_shipping_origin_id, :city, :street_address, :apartment_name, :tel)
end

というコード内においてどうやらmergeが必要だったことがわかった。

今回はmergeの使い方を考えてみます。

結論mergeとはハッシュとハッシュの結合ということが分かった。


tweet = { name: "たなか", text: "test", image: "test.jpeg" }
uid = { user_id: "1" }
tweet.merge(uid)
=> {:name=>"たなか", :text=>"test", :image=>"test.jpeg", :user_id=>"1"}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?