Skip to content

Instantly share code, notes, and snippets.

@hrysd
Last active December 13, 2015 21:29
Show Gist options
  • Select an option

  • Save hrysd/4977845 to your computer and use it in GitHub Desktop.

Select an option

Save hrysd/4977845 to your computer and use it in GitHub Desktop.
これ知らなかった。
@hoge = Hoge.new(params[:hoge]) do |h|
  h.user = current_user
end

Hoge.create(params[:hoge]) do |h|
  h.user = current_user
end

User.create([{ name: 'hoge'}, { name: 'huga' }, { name: 'piyo' }]) do |u|
  u.password = 'test'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment