gems/ruby-2.2.0@interview_questions/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `exec_query'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activerecord-4.2.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:192:in `exec_insert'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:108:in `insert'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activerecord-4.2.0/lib/active_record/relation.rb:64:in `insert'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activerecord-4.2.0/lib/active_record/persistence.rb:521:in `_create_record'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activerecord-4.2.0/lib/active_record/counter_cache.rb:139:in `_create_record'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activerecord-4.2.0/lib/active_record/attribute_methods/dirty.rb:127:in `_create_record'
[Truncated]
... 63 levels...
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
	from /Users/username_0/Development/interview_questions/bin/rails:8:in `<top (required)>'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /Users/username_0/.rvm/gems/ruby-2.2.0@interview_questions/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
	from /Users/username_0/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Users/username_0/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from -e:1:in `<main>'
```

As you can see, it's trying to insert a row without `depth` assigned, but the column is defined as `NOT NULL`, per the readme.  It looks like the `set_depth!` callback is running until after save, which is too late to assign a value for a column that doesn't permit nulls.  Is this a bug in the gem, or in the documentation?
<issue_comment>username_1: Ah, yeah, that'll be a documentation problem unless you could see a way that we could figure out the depth before we save it?
<issue_comment>username_0: I had a similar issue on the `children_count` field as well.  I ended up working around both by assigning a default value on both columns:

```ruby
t.integer :depth, null: false, default: 0
t.integer :children_count, null: false, default: 0
```

For performance reasons, I think it would be nice to calculate the depth prior to the insert, or more ideally, as part of the insert by adding one to the parent_id if parent_id is set.  (Or at least I assume this is essentially what the Ruby code is doing without digging into it.)

I will try to take a look at this when I can grab some free time.  I'll also open a pull request to address the README for the default value thing prior to closing this if that sounds reasonable.
<issue_comment>username_1: Thanks, Matt!<issue_closed>Psychoanalysis shows the sexual organization of the body physical to be a political organization; the body is a body politic. Psychoanalysis stands or falls on the expansion of the idea of sexuality to comprehend the entire life of the human body; attributing a sexual (“erotogenic”) action to all parts, organs, or "zones"; or rather, envisaging sexuality as an energy diffused throughout the whole body, and capable of displacement from one part to another, and of transformation from one mode of manifestation to an­other ( polymorphism; metamorphosis). What the psycho­analytically uninitiated call "sex”, psychoanalysis calls "genitality”, or "genital organization”, seeing in it an arrangement, a modus vivendi, a political arrangement ar­rived at after stormy upheavals in the house of Oedipus. The arrangement is to concentrate sexuality in one part of the body, the genital; this concentration, or organization, establishes the "primacy" of one "component-im­pulse," which is now the "dominating" or "supreme" component-impulse in the sexual life of the body. It is, says Freud, a well-organized tyranny, of a part over the whole.
Cf. Freud, General Introduction, 332.
Brown, Life Against Death, 25-28.
Ferenczi says the genital is "the unique and incomparable magic wand which conjures and captures the erotism of the entire body."Read more SuckingCock SuckingCockGif DoubleBlowjob.
#babe, #amateur, #beingfed, #amateur, #bigcock, #1000views, #arianamarie, #GAY