new(attributes = nil, &block) public

Initializes new record from relation while maintaining the current scope.

Expects arguments in the same format as

users = User.where(name: 'DHH')
user = # => #<User id: nil, name: "DHH", created_at: nil, updated_at: nil>

You can also pass a block to new with the new record as argument:

user = { |user| = 'Oscar' } # => Oscar
Show source
Register or log in to add new notes.