Skip to content

Rails 4.2 assoziation restriction is broken when invoking build #60

@toxix

Description

@toxix

Just tried to upgrade to Rails 4.2. When I'm calling build on a has_many assoziation, all the assoziated records are going to be unrestricted. Think this is potentially dangerous as I'm expecting associations of a protected model are protected.

f = Film.restrict!(User.first).first

f.images.first.protector_subject?
 # => true
f.images.build
f.images.first.protector_subject?
 # => false <<== should be true
f.images.protector_subject?
 # => true

This is not hapening with Rails 4.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions