I’m not quite sure what a saved record with unassigned attributes means.
user = User.create!(name: 'abcde', long_name: 'abcdefgh')
user.reload
user.name = 'abcde'
user.long_name = 'new name'
user.save
Perhaps something like this?
I’m not quite sure what a saved record with unassigned attributes means.
user = User.create!(name: 'abcde', long_name: 'abcdefgh')
user.reload
user.name = 'abcde'
user.long_name = 'new name'
user.save
Perhaps something like this?
I guess it’s default value from migration. i.e. AR skips setting the value and padded by PG later on.
Is there an example? I still don’t quite understand what it means
Suppose your example:
Migration:
create_table :users do |t|
t.text :name, null: false
t.text :long_name, default: 'long'
t.timestamps
end
long_name
is not assigned in that case:
user = User.new(name: 'abcde')
user.save