Skip to content

Stack Overflow scrape error #119

@neight-allen

Description

@neight-allen

To reproduce:

heroku run rake job_fetch:all_jobs

You'll end up with the following error:

ActiveRecord::RecordNotSaved: You cannot call create unless the parent is saved
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/associations/collection_association.rb:486:in `_create_record'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/associations/has_many_association.rb:187:in `_create_record'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/associations/collection_association.rb:153:in `create'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/association_relation.rb:22:in `block in create'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/relation.rb:302:in `scoping'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/association_relation.rb:22:in `create'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/relation.rb:155:in `first_or_create'
/app/app/services/job_fetcher.rb:24:in `create_job'
/app/app/services/job_fetcher.rb:9:in `create_records'
/app/app/services/job_fetcher.rb:3:in `create_records'
/app/app/services/stack_overflow.rb:20:in `block in format_entries'
/app/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'
/app/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:186:in `upto'
/app/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:186:in `each'
/app/app/services/stack_overflow.rb:18:in `map'
/app/app/services/stack_overflow.rb:18:in `format_entries'
/app/app/services/stack_overflow.rb:13:in `scrape'
/app/lib/tasks/job_fetch.rake:12:in `block (3 levels) in <top (required)>'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions