id
type
5 (blog/news article)
status
21 (imported old-v2, waiting for another import)
review version
0
cleanup version
0
pending deletion
0 (-)
created at
2025-12-04 02:49:59
updated at
2025-12-04 02:50:00
url
https://matt.berther.io/2012/09/09/validating-habtm-relationships-with-rails-3x/
url length
80
url crc
55316
url crc32
3318142996
location type
1 (url matches target location, page_location is empty)
canonical status
10 (verified canonical url)
canonical page id
domain id
domain tld
86
domain parts
0
originating warc id
-
originating url
https://data.commoncrawl.org/crawl-data/CC-MAIN-2025-33/segments/1754151279901.12/warc/CC-MAIN-20250806074443-20250806104443-00735.warc.gz
source type
11 (CommonCrawl)
server ip
Publication date
2025-08-06 08:41:04
Fetch attempts
0
Original html size
17652
Normalized and saved size
14964
title
Validating HABTM relationships with Rails 3.x
excerpt
content
There comes a time as you build up a rails application that you end up using the has_and_belongs_to_many (HABTM) macro. This macro is an easy way to create a many-to-many relationship between two of your ActiveRecord models. In some cases you may want to validate that association. However, the traditional methods for validating rails models do not work. The unit tests below described how I wanted the relationship to function. class ProjectTest < ActiveSupport::TestCase setup do @project = Project.new() end test "may have many developers" do 4.times { @project.developers << FactoryGirl.create(:developer) } assert @project.save end test "must have at least one developer" do @project.save assert_equal 1, @project.errors.count assert_not_nil @project.errors[:developers] end end In my case, I was hoping to validate that each project had at least one developer associated to it. Initially, I coded my models to make the first test p...
author
updated
2025-12-05 09:59:50
block type
0
extracted fields
233
extracted bits
featured image
title
full content
content was extracted heuristically
OpenGraph suggests this is an article
detected location
0
detected language
1 (English)
category id
Other [en] (231)
index version
2025123101
paywall score
0
spam phrases
0
text nonlatin
0
text cyrillic
0
text characters
1631
text words
326
text unique words
138
text lines
1
text sentences
13
text paragraphs
1
text words per sentence
25
text matched phrases
0
text matched dictionaries
0
links self subdomains
0
links other subdomains
0
links other domains
links spam adult
0
links spam random
0
links spam expired
0
links ext activities
0
links ext ecommerce
0
links ext finance
0
links ext crypto
0
links ext booking
0
links ext news
0
links ext leaks
0
links ext ugc
0
links ext klim
0
links ext generic
0
status
0
updated
2025-12-05 09:59:50
image author
featured image