paper_trail-association_tracking icon indicating copy to clipboard operation
paper_trail-association_tracking copied to clipboard

NotImplementedError seen during has_paper_trail method Call

Open carmageddon888 opened this issue 4 months ago • 1 comments

So we are upgrading our app from Ruby 2.7.8 -> 3.0.0 and Rails 5.2 -> 7.0.8.4 After installation of gems, when we run the rails console we see the error. Following are the details :-

1. What versions are you using?

ruby (3.0.0) rails (7.0.8.4) paper_trail (13.0.0) paper_trail-association_tracking (2.2.0)

2. Define your tables here.

Schema for websites table => create_table "websites", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "live_website_id" t.integer "desktop_website_id" t.integer "account_id", default: 0, null: false t.integer "tier_id" t.string "label", default: "", null: false t.string "url", default: "", null: false t.string "domain" t.string "raw_domain", default: "", null: false t.string "staging_domain", default: "", null: false t.string "mobile_domain", default: "", null: false t.string "staging_user", default: "", null: false t.string "staging_pass", default: "", null: false t.integer "staging_port" t.boolean "is_mobile", default: false, null: false t.boolean "is_mvd", default: false t.integer "last_finished_audit_comparison_id" t.integer "last_finished_robots_txt_audit_comparison_id" t.boolean "use_live_urls_in_diffs" t.boolean "is_test_robots_txt_in_svl_comparison" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false t.boolean "is_wordpress", default: false, null: false t.datetime "gwt_last_messages_updated_at", precision: nil t.datetime "audit_scheduled_at", precision: nil t.boolean "include_landing_audit_urls", default: false, null: false t.datetime "robots_txt_audit_scheduled_at", precision: nil t.boolean "is_freeze_audit_scheduled_at", default: false t.datetime "second_audit_scheduled_at", precision: nil t.datetime "gwt_audit_scheduled_at", precision: nil t.integer "mobile_implementation", default: 0, null: false t.integer "mobile_implementation_old", default: 0 t.integer "analytics_package", default: 0 t.string "alternate_url" t.integer "threads_limit", default: 3 t.string "user_agent", limit: 4096, default: "Seoradar" t.string "user_agent2", limit: 4096 t.boolean "is_strip_numerics_in_diff", default: false t.boolean "is_ignore_hashtag", default: true t.boolean "is_ignore_url_query_in_diff" t.integer "ga_credential_id" t.integer "wmt_credential_id" t.string "wmt_domain" t.date "wmt_last_existed_date" t.datetime "gwt_wal_report_scheduled_at", precision: nil t.boolean "is_wmt_processing", default: false, null: false t.boolean "email_delayed_wal_data_dispatched", default: false, null: false t.integer "ga_profile_id" t.integer "migration_from_service_level_id", null: false t.integer "deleted_at", default: 0, null: false t.boolean "is_sync_urls_with_parent_website", default: false, null: false t.integer "links_count", default: 0, null: false t.boolean "is_demo", default: false, null: false t.boolean "is_competitor", default: false, null: false t.boolean "ignore_robots_txt", default: false, null: false t.boolean "tag_comparison_v2", default: false, null: false t.boolean "use_proxy", default: false, null: false t.boolean "recreate_storage_links", default: false, null: false t.boolean "detect_redirect_to_new_content", default: false, null: false t.boolean "treat_as_ajax", default: false, null: false t.boolean "tag_comparison_v3", default: true, null: false t.boolean "tag_comparison_v4", default: true, null: false t.integer "add_urls_via", default: 0, null: false t.integer "number_of_urls_to_add" t.boolean "tag_comparison_v5", default: true, null: false t.boolean "is_urls_group", default: false t.string "competitive_group_keyword_phrase" t.string "competitive_group_country" t.boolean "is_gvc", default: false t.string "http_id" t.string "http_crypt_password" t.boolean "is_exclude_months_from_diff", default: true t.string "render_filter_type", limit: 3, default: "DIS" t.string "render_filter_value" t.string "render_value" t.string "page_type_metadata_name" t.boolean "is_dom_vs_fetched", default: false t.string "competitive_group_location" t.string "header_name" t.string "header_value" t.integer "device_type", default: 0 t.boolean "discover_sitemaps_status", default: false t.integer "screenshot_delay", default: 0 t.boolean "rendered_vs_rendered", default: false t.string "staging_robots_url" t.boolean "block_index_and_robot_url_alerts", default: false t.float "page_size_alert_threshold" t.float "link_count_threshold" t.float "sitemap_changes_threshold" t.float "words_count_threshold" t.boolean "sitemaps_alerts_on_totals_only" t.boolean "is_km_processings", default: false t.datetime "keyword_monitoring_scheduled_at", precision: nil t.float "branded_ctr_threshold" t.boolean "allow_branded_keyword_ctr_alerts" t.datetime "branded_ctr_last_existed_date", precision: nil, default: "2024-10-15 13:05:08" t.boolean "inhibit_wal_report", default: false t.boolean "weekly_add_url_from_sitemaps", default: false t.integer "max_no_of_urls_to_add_from_sitemaps", default: 0 t.datetime "weekly_sitemap_monitoring_date", precision: nil, default: "2024-10-15 13:05:09" t.boolean "is_use_production_scan", default: false t.boolean "auto_add_search_console_top_pages", default: false t.integer "number_of_auto_add_sc_top_pages", default: 100 t.boolean "check_url_indexing" t.integer "url_fetcher_gem" t.integer "max_scheduled_audits_per_day" t.boolean "mobile_rendered_vs_rendered", default: false t.boolean "allow_404_auto_delete_urls", default: false t.boolean "allow_redirect_auto_delete_urls", default: false t.boolean "allow_no_index_auto_delete_urls", default: false t.boolean "domain_url_redirect_disabled", default: false t.integer "max_fallen_of_top_count", default: 4 t.boolean "stealth_mode", default: false t.float "next_url_fetch_can_occur_after", limit: 53, default: 1728997527.1281614, null: false t.float "max_requests_per_minute", default: 200.0, null: false t.index ["account_id", "label", "deleted_at"], name: "index_websites_on_account_id_and_label_and_deleted_at", unique: true t.index ["audit_scheduled_at"], name: "index_websites_on_audit_scheduled_at" t.index ["deleted_at", "is_demo"], name: "index_websites_on_deleted_at_and_is_shared" t.index ["gwt_audit_scheduled_at"], name: "index_websites_on_gwt_audit_scheduled_at" t.index ["gwt_wal_report_scheduled_at", "deleted_at"], name: "index_websites_on_gwt_wal_report_scheduled_at_and_deleted_at" t.index ["is_mobile", "is_mvd", "is_competitor", "is_gvc", "is_urls_group", "is_dom_vs_fetched", "rendered_vs_rendered"], name: "websites_boolean_fields" t.index ["staging_domain"], name: "index_websites_on_staging_domain" t.index ["tier_id"], name: "index_websites_on_tier_id" end

Schema for versions table => create_table "versions", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| t.string "item_type" t.string "{:null=>false, :limit=>191}" t.integer "item_id", null: false t.string "event", null: false t.string "whodunnit" t.text "object", size: :long t.datetime "created_at", precision: nil t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" end

No table named version_associations

Define your AR models here.

class Website < ActiveRecord::Base has_paper_trail only: [:user_agent, :header_name, :header_value] end

Please write a test that demonstrates your issue.

When i execute the command bundle exec rails console i see the following error:

"## dependent=delete_all model=Website self=ActiveRecord::Associations::Builder::HasMany #"
"## valid_dependent_options=[:destroy, :delete_all, :nullify, :restrict_with_error, :restrict_with_exception, :destroy_async] ##"

"## dependent=delete_all model=Website self=ActiveRecord::Associations::Builder::HasMany #"
"## valid_dependent_options=[:destroy, :delete_all, :nullify, :restrict_with_error, :restrict_with_exception, :destroy_async] ##"

"## dependent=delete_all model=Website self=ActiveRecord::Associations::Builder::CollectionAssociation #"
Exiting

/usr/local/bundle/gems/activerecord-7.0.8.4/lib/active_record/associations/builder/association.rb:126:in `valid_dependent_options': NotImplementedError (NotImplementedError)

	from /usr/local/bundle/gems/activerecord-7.0.8.4/lib/active_record/associations/builder/association.rb:135:in `check_dependent_options'

	from /usr/local/bundle/gems/activerecord-7.0.8.4/lib/active_record/associations/builder/association.rb:78:in `define_callbacks'

	from /usr/local/bundle/gems/activerecord-7.0.8.4/lib/active_record/associations/builder/collection_association.rb:14:in `define_callbacks'

	from /usr/local/bundle/gems/paper_trail-association_tracking-2.2.0/lib/paper_trail_association_tracking/model_config.rb:59:in `setup_habtm_change_callbacks'

	from /usr/local/bundle/gems/paper_trail-association_tracking-2.2.0/lib/paper_trail_association_tracking/model_config.rb:38:in `each'

	from /usr/local/bundle/gems/paper_trail-association_tracking-2.2.0/lib/paper_trail_association_tracking/model_config.rb:38:in `setup_callbacks_for_habtm'

	from /usr/local/bundle/gems/paper_trail-association_tracking-2.2.0/lib/paper_trail_association_tracking/model_config.rb:14:in `setup'

	from /usr/local/bundle/gems/paper_trail-13.0.0/lib/paper_trail/has_paper_trail.rb:68:in `has_paper_trail'

	from /var/www/seoradar-engine/app/models/website.rb:182:in `<class:Website>'

I had added logs in gem code.

From what i understand, the issue is being caused by that part of code in paper_trail-association_tracking gem which was added recently ( i think v 2.2.0 )

carmageddon888 avatar Oct 16 '24 06:10 carmageddon888