Thoughts Heap

A Blog by Roman Gonzalez.-

RSS
May
29th
Fri
permalink

Rails had improved A LOT since last visit

GameParticipation on schema.rb


  create_table "game_participations", :force => true do |t|
    t.integer  "giver_id"
    t.integer  "receiver_id"
    t.integer  "game_id"
    t.datetime "activated_at"
    t.date     "occurs_on"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

The error:


ActiveRecord::HasManyThroughSourceAssociationNotFoundError in 'Game#is_participating? should return false when the user is not participating on the game'
Could not find the source association(s) :participant or :participants in model GameParticipation.  Try 'has_many :participants, :through => :participations, :source => '.  Is it one of :game, :giver, or :receiver?

What impress me about this error, is the las part of the last sentence “Is it one of :game, :giver, or :receiver?”…  If they wouldn’t add the last sentence, my first question would be “WTF is source?”, this meaningful error helped me save some time.

Good Job Rails Team \m/.

blog comments powered by Disqus