Skip to content

Instantly share code, notes, and snippets.

@landlessness
Created September 24, 2010 19:44
Show Gist options
  • Select an option

  • Save landlessness/595914 to your computer and use it in GitHub Desktop.

Select an option

Save landlessness/595914 to your computer and use it in GitHub Desktop.
# i started with the following, which i thought would work with no problem:
AddOn.joins(:pricing_plans).joins(:subscriptions)
# returned this error:
# ActiveRecord::ConfigurationError:
# Association named 'subscriptions' was not found; perhaps you misspelled it?
# trying to get at it from the other direction:
PricingPlan.joins(:subscriptions).joins(:person)
# of course this didn't work either
# ActiveRecord::ConfigurationError: Association named 'person' was not found; perhaps you misspelled it?
# here i shoot in the dark hoping something Arel-like would magically happen:
AddOn.joins(:pricing_plans).joins(:subscriptions).on(pricing_plans[id].eq(subscriptions[pricing_plan_id]))
# of course not. (this is embarrassing)
# NameError: undefined local variable or method `pricing_plans' for #<Object:0x1001d52a8>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment