Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11565 (closed defect: duplicate)

Opened 1 year ago

Last modified 1 year ago

has_many :through .create with no parameters causes a "can't dup NilClass" error

Reported by: ssoroka Assigned to: core
Priority: normal Milestone: 2.1
Component: ActiveRecord Version: edge
Severity: normal Keywords: patch
Cc:

Description

has_many :through .create with no parameters causes a "can't dup NilClass" error

Attachments

has_many_through_fix_create_with_no_params.diff (2.0 kB) - added by ssoroka on 04/21/08 14:34:37.

Change History

04/10/08 16:09:57 changed by boram

+1

04/21/08 04:43:23 changed by nzkoz

I may be missing something but I don't quite see why we want to skip the scoping when there's no arguments?

04/21/08 14:33:23 changed by ssoroka

There's no point of applying a scope if there are no parameters being passed to it. The through association is still properly handled without it.

Though I see now that I missed .create!, attaching new patch

04/21/08 14:34:37 changed by ssoroka

  • attachment has_many_through_fix_create_with_no_params.diff added.

04/21/08 14:36:24 changed by ssoroka

I guess an alternative approach would be to change with_scope to handle nil valued keys, but I didn't think that felt right.

05/01/08 16:48:11 changed by ssoroka

  • milestone changed from 2.x to 2.1.

05/01/08 19:13:48 changed by ssoroka

  • status changed from new to closed.
  • resolution set to duplicate.