Bench with unassigned attributes


I’m not quite sure what a saved record with unassigned attributes means.

user = User.create!(name: 'abcde', long_name: 'abcdefgh')
user.reload = 'abcde'
user.long_name = 'new name'

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 :slight_smile:


Suppose your example:


create_table :users do |t|
  t.text :name, null: false
  t.text :long_name, default: 'long'

long_name is not assigned in that case:

user = 'abcde')